Perl qw-operator in Python?

I am a native perl, but lately have been using python very often. I was wondering if there is something similar to the perl qw // operator, which is a shortcut to get around a set of several quotes and commas when creating a list of several lines that do not include spaces.

Example: @list = qw(Paul Michael Jessica Megan); (from wikibooks

I can’t find anything, but the name of the operator may be completely different ... Greetings, Lars

+4
source share
1 answer

No, but you can use split :

 my_list = "Paul Michael Jessica Megan".split(" ") 
+6
source

Source: https://habr.com/ru/post/1390052/


All Articles