| | If you have a fixed number of elements that are either strings or non-sequential numbers,
use this form of the for loop. This syntax matches Python.
for i in 5,10,3,-8
Print (i)
5
10
3
-8
for text in 'Hi!','I am','Yami..'
Print (text)
Hi!
I am
Yami..
And you can also loop over the content of a file:
for id in file /home/yasara/pdb_id.txt
Clear
LoadPDB (id)
CountRes all
In the example above, the file pdb_id.txt contains a list of PDB IDs to loop over. In this simple text file,
you can use either commas or linefeeds to separate the elements:
# Example for valid loop-file:
# Line starting with '#' are ignored.
# Using linefeeds to separate
1CRN
5TIM
# Using commas to separate
1SOL, 1STY,1THV
# By default, strings are weak strings, single quotes are not essential:
'1RIS', '1RWT'
# Double quotes are needed to specify strong strings:
"1VII","1YAS"
# Integers and floats are also allowed:
1,2,3
5.7, -1e60
|