LINUX.ORG.RU

История изменений

Исправление KennyMinigun, (текущая версия) :

Как-то так:

#!/usr/bin/python

if __name__ == '__main__':
    string = """
        This is line 1
        This is line 2
        This is line 3
    """
    array = string.split('\n')
    print "LINES: %s" % len(array)
    for line in array:
        print "LINE: " + line

Исходная версия KennyMinigun, :

Как-то так:

#!/usr/bin/python

if __name__ == '__main__':
    string = """
        This is line 1
        This is line 2
        This is line 3
    """
    array = string.split('\n');
    for line in array:
        print "LINE: " + line