Answer the question
In order to leave comments, you need to log in
How to remove quotes from a list in Python?
Hello, there was a problem when writing numbers to a sheet, you need them to be written without quotes ["123456789", "123456789"], i.e. like this - [123456789, 123456789]
Here is the script itself:
if msg[0:4] == "%бан":
get_user = re.search("\d{1,}", msg)
user_id = event.obj["from_id"]
if user_id in creator:
if get_user[0] not in ban_list:
ban_list.append(get_user[0])
print(ban_list)
with open('ban_list.txt', 'w') as filehandle:
json.dump(ban_list, filehandle)
Answer the question
In order to leave comments, you need to log in
Hope it helps. :)
The third link on request in Google:
You can join words into one line using join with a space as a separator, and then output:
words = ['end', 'nend'] print(' '.join(words))
Another option, if just words need to be output, then you can pass a list of words to print through an asterisk, then each word will be passed to print as a separate parameter:
words = ['end', 'nend'] print(*words)
To display the same words on several lines, in the first variant we simply change the separator to '\n':
words = ['end', 'nend'] print('\n'.join(words))
In the second option, you still need to explicitly set the separator:
words = ['end', 'nend'] print(*words, sep='\n')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question