User:Orso.b.schmid

From Vectorworks Developer
Revision as of 12:54, 17 May 2015 by CBM-c- (talk | contribs) (comments of list creation)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Ciao,

I am Orso, an Italian Vectorscripter since many years. I feel very comfortable with VS but will now switch over to Python for even more power. I will try to share here comments, problems -and solutions- from the point of view of a non-programmer. --Orso.b.schmid (talk) 08:13, 17 May 2015 (EDT)

Open the terminal on your Mac and write

python

Lists

Lists are powerful in Python, below some fascinating lists manipulations. They remind me of Applescript:

months = "Jan Feb Mar Apr May Jun Jul"
months = months.split() # no splitter defined and it will use the empty space --> ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul']
months2 = "Jan, Feb, Mar, Apr, May, Jun, Jul" # overwrite a copy
months2.split(', ') # use comma and empty space as splitter --> ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul']
months.append('Jul') # append adds an item to a list --> ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul']
months.pop() # pop fetches the last item of a list --> 'Jul'
', delirious '.join(months) # --> 'Jan, delirious Feb, delirious Mar, delirious Apr, delirious May, delirious Jun, delirious Sep'
'-'.join(months[1:3]) # --> 'Feb-Mar'