Guys, is it possible to output an array without commas, brackets and - Python
yannisnedostup
12/18/2020, 8:49:22 PM
Ответов:
Guys, is it possible to output an array without commas, brackets and

quotes?

Ответы (26)

Аноним
12/18/2020, 8:50:15 PM

Array or list

Daniil Nedostup
12/18/2020, 8:51:02 PM

list, sorry

Jonathan Livingston
12/18/2020, 8:51:09 PM

print(*your_list)

Аноним
12/18/2020, 8:53:27 PM

This looks easy

Daniil Nedostup
12/18/2020, 8:53:48 PM

ahah, but it's working))

Jonathan Livingston
12/18/2020, 8:53:53 PM

sorry, you don't really need the sep=' ' part

Аноним
12/18/2020, 8:54:39 PM

Ik ik So cool

Daniil Nedostup
12/18/2020, 8:55:15 PM

I need. With sep i havn't gaps in output thank you!

Jonathan Livingston
12/18/2020, 8:55:32 PM

hm, strange

Jonathan Livingston
12/18/2020, 8:59:33 PM

so yeah, i think ''.join(generated_password) would be more logical for you

Daniil Nedostup
12/18/2020, 9:00:23 PM

I will read about it, but now I did it with ".append"

Jonathan Livingston
12/18/2020, 9:00:47 PM

show me the code where you generate the password

Daniil Nedostup
12/18/2020, 9:08:37 PM

charlist = ['a','b','c','0','1','2','3','4','5','6','7','8','9'] l = [] for i in range(int(sys.argv[2])): for i in range(int(sys.argv[1])): l.append(random.choice(charlist)) i+=1 print(*l, sep='') l=[]

Daniil Nedostup
12/18/2020, 9:09:53 PM

Output: 7c02563b 38890592 9910c423

Jonathan Livingston
12/18/2020, 9:09:55 PM

there are string.ascii_lowercase and string.digits

Daniil Nedostup
12/18/2020, 9:16:44 PM

oh, thank you! I wrote: charlist = string.ascii_letters + string.digits It's working better!

Daniil Nedostup
12/18/2020, 9:17:46 PM

What about other symbols, like ";{})"...

Jonathan Livingston
12/18/2020, 9:18:32 PM

there is string.punctuation

Jonathan Livingston
12/18/2020, 9:19:58 PM

also you may define the l var inside a loop so you don't have to clear it every time

Daniil Nedostup
12/18/2020, 9:34:02 PM

I did it + string.punctuation. The code is now simpler and cleaner and the output is what I need. Thank you!!

Jonathan Livingston
12/18/2020, 9:34:49 PM

i'd do something like this, and format the code to follow pep8 yeah, and change the pass to something different, since it's a reserved name

Daniil Nedostup
12/19/2020, 6:16:03 PM

Hello Jonathan! Do you know how to generate a password from a template?

Jonathan Livingston
12/19/2020, 7:00:15 PM

What do you mean by a template?

Daniil Nedostup
12/19/2020, 7:44:12 PM

When generating the password, I need to specify which characters should be in the password. And set them as a key, as I did with the quantity. For example: python test.py 8 2 \d{3}\A\a\ (At least three digits, 1 uppercase and 1 lowercase letter) Where "d" are numbers from 0 to 9, "A" are uppercase letters, and "a" are lowercase letters. My code: https://del.dog/aduxygnobi

Jonathan Livingston
12/19/2020, 7:48:46 PM

I'd make a dict where the keys would be, well, your keys, e. g. \d and values - string objects

Jonathan Livingston
12/19/2020, 7:49:51 PM

DM me and I'll explain in details

Похожие вопросы по теме Python

mooler_z
6/11/2021, 1:27:26 PM
Ответов: 26
» vv = "o\\xd7\\xe2\\xf5\\x1a\\x1a\\xb3\\xb1Y#\\x06\\xa8v\\x8c\\x11\\xc0B\\n\\x95,;\\xd9Ub\\xe5&\\xd7\\xf9\\x9d\\xc8\\x9cN*\\x17\\xe4\\x01\\xd6\\xe5u%\\x0f\\x82\\xaa\\xed\\x8az\\xd1t\\xc5\\xcd\\xd6.?\\xe81KK\\xec\\xa4K\\xea\\x1axr\\xa5\\xe3U\\xf0\\x02\\xd8\\x07\\xcb\\x18\\xd4K\\x0bC\\xd4\\xbc\\xa6\\xa0\\xcb>I\\xdf\\x9dS\\xd9\\x17\\xad\\x12\\xcbx\\xb5\\x08\\xe6?\\xd5m~\\x12\\x84?\\x80_`JLd.\\x05\\x88\\xcd\\xe3\\xf6\\xe5\\x9f\\x88d\\x06\\xfb\\x95\\x9e\\xe8\'\\xe6\\x0e" » vv.replace"\\", "\" SyntaxError: EOL while scanning string

literal

Аноним
6/3/2021, 7:34:49 AM
Ответов: 25
1 2 3 4

5 16 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9 Can anyone crack the code?

dizaztor
3/19/2021, 1:22:53 PM
Ответов: 25
New member? Then you've been muted for 5 mins, to read the

rules properly before doing anything, please don't PM anyone asking why you were muted! This group is English-only, send !ol to the bot for other choices different languages. • Learn Python 📖 📚 some resources, so avoid asking for any Python PDFs/Videos please. • How to ask questions properly. • Rules for this chat. • Offtopic chat • Advanced Python Talk Asking for [homework|exams] [solutions|cheats] are ban-able! #pin #pinned #pinnedmessage

piter_pansgf
12/20/2020, 6:07:36 PM
Ответов: 25
def joinlist: str = "" for i in

list : str += i return str a = input"write word : " b = input"write simvol : " printjoina,b I want to join a and b, why not?

Аноним
6/21/2021, 2:42:35 PM
Ответов: 26
I have two dictionaries as a json file without any comma seperation

, how do o read the json file ?

Аноним
4/8/2021, 5:56:36 AM
Ответов: 26
I have a question. Which data structure is faster? List, Dict or

Set? if x in List if x in Dict if x in Set

Аноним
1/27/2021, 9:26:43 PM
Ответов: 24
Can someone help me in this? what's is wrong in this code?

a=2 b=2 c=-1 d = b**2 - 4*a*c x1=-b + d**1/2/2*a x2=-b - d**1/2/2*a printd, x1, x2

Lapanit
10/18/2020, 3:07:59 AM
Ответов: 24
Did you create a venv, activate it, install the required modules inside

it and execute your py file?

Аноним
11/11/2020, 1:09:41 PM
Ответов: 23
Guys, could someone try to help me in my doubt regarding editing

csv files?? https://del.dog/arefeafuly i tried to declare the inputs as BINARY and STR, but even way i get the same error "TypeError: a bytes-like object is required, not 'str'"

Аноним
5/15/2021, 2:14:11 PM
Ответов: 23
What to learn in Python after OOP?