繁体   English   中英

我该如何进行这项工作它只是在我的代码 python 中说无效的 sintax 我正在尝试为不需要数字的帐户设置密码

[英]how do i make this work it just says invalid sintax in my code python i am trying to make a password for my accounts that doesnt require numbers

这是我在 text.close() 中的代码,它说无效的 sintax

import random
import string



def generate_random_string(length):
    
    letters = string.ascii_uppercase
    rand_string = ''.join(random.choice(letters) for i in range(length))
    text.write(srt(rand_string)
    text = open('password.txt', 'w')
    text.close() #error here
generate_random_string(19)


请修复它我不知道答案我正在学习这种编程语言

你忘了一个右括号:

text.write(srt(rand_string)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM