当前位置: 首页>>代码示例>>Python>>正文


Python nester.print_lol函数代码示例

本文整理汇总了Python中nester.print_lol函数的典型用法代码示例。如果您正苦于以下问题:Python print_lol函数的具体用法?Python print_lol怎么用?Python print_lol使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了print_lol函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: print_lol

def print_lol(the_list,level):
    for each_item in the_list:
        if isinstance(each_item,list):
           print_lol(each_item)
        else:
            for tab_stop in range(level):
                print("\t",end="")
            print(each_item)
开发者ID:linuxwd,项目名称:python-practice,代码行数:8,代码来源:practice.py

示例2: print_lol

# def print_lol(the_list):
#     for each_item in the_list:
#         if isinstance(each_item, list):
#             print_lol(each_item)
#         else:
#             print(each_item)

import nester

from nester import print_lol

m_array = ['a','b','c',['d',['e','f']]]

# namespace
# nester.print_lol(m_array)
#
# print_lol(m_array)
# nester.print_lol(m_array,3);

nester.print_lol(m_array);
开发者ID:EthanProg,项目名称:python_project,代码行数:20,代码来源:recursion.py

示例3:

#!/usr/bin/python

import nester;


mylist = ["dave","dtormey","has","an","impressive","six-pack" ] 


nester.print_lol(mylist)
开发者ID:tormeyd,项目名称:learningpython,代码行数:9,代码来源:test_nester.py

示例4:

import nester

cast = ["Palin", "Cleese", "Idle", "Jones", "Gilliam", "Chapman"]

nester.print_lol(cast)
开发者ID:zess1982,项目名称:zessheadfirst,代码行数:5,代码来源:test.py

示例5:

import nester
cast = ["Palin", "Cleese",["dd", "dd",[1,1,1]], "Idle", "Jones", "Gillian", "Chapman"]
nester.print_lol(cast, 0)
开发者ID:gzg0612,项目名称:myPython,代码行数:3,代码来源:cast.py

示例6: print

        #print_lol(man, fn = man_file)
        #print_lol(other, fn = other_file)

except IOError as err1:
    print('File error: ' + str(err1))

except pickle.PickleError as perr:
    print('Pickle Error: ' + str(perr))

try:
    with open('man_data_1.txt', 'rb') as man_file:
        new_man = pickle.load(man_file)

except IOError as err1:
    print('File error: ' + str(err1))

except pickle.PickleError as perr:
    print('Pickle Error: ' + str(perr))

print_lol(new_man)

# Git practice








开发者ID:vincn,项目名称:PythonPractice,代码行数:22,代码来源:fileProcessing.py

示例7: print

man=[]
other=[]

try:
        data=open('sketch.txt')
        for each_line in data:
                try:
                        (role,line_spoken) = each_line.split(':',1)
                        line_spoken=line_spoken.strip()
                        if role=='Man':
                                man.append(line_spoken)
                        if role=='Other Man':
                                other.append(line_spoken)
                except ValueError:
                        pass
        data.close()
	
except IOError:
        print('the data file is missing!')
        

try:
        with open('man_data.txt','w')as man_file:
                print_lol(man,fh=man_file)
        with open('other_data.txt','w')as other_file:
                print_lol(other,fh=other_file)
                
except IOError as err:
        print('File error:'+str(err)) 
开发者ID:Oucsicie,项目名称:headfirstpython,代码行数:29,代码来源:sketch.py

示例8: open

    data = open('sketch.txt') #打开文件
    for each_line in data:#遍历文件
        try:
            (role,line_spoken) = each_line.split(':',1) #将每行按照:分成2部分
            line_spoken = line_spoken.strip()#去除多余空格
            if role == 'Man':#如果role是man, 把line_spken 压入man list
                man.append(line_spoken)
            elif role == 'Other Man':
                other.append(line_spoken)
        except ValueError:
            pass
    data.close()#关闭I/O
except IOError:
    print('The data file is missing!')

try:
    with open('man_data3.txt','w') as out_man:
        print_lol(man,fh=out_man)
    with open('other_data3.txt','w') as out_other:
        print_lol(other,fh=out_other)
except IOError as err:
    print('File Error: '+str(err))


try:
    with open('man_data3.txt','w') as out_man,open('other_data3.txt','w') as out_other:
        print_lol(man, fh=out_man)
        print_lol(other,fh=out_other)
except IOError as err:
    print('File Error: '+str(err))    
开发者ID:Emersonxuelinux,项目名称:PYTHON-,代码行数:30,代码来源:08-fileoperator-with.py

示例9: open

other = []

try:
    os.chdir('/home/dlete/python_lab/ch04')
    data = open('sketch.txt')

    for each_line in data:
        try:
            (role, line_spoken) = each_line.split(":", 1)
            line_spoken = line_spoken.strip()
            if role == 'Man':
                man.append(line_spoken)
            elif role == 'Other Man':
                other.append(line_spoken)
        except ValueError:
            pass

    data.close()

except IOError:
    print('The data file is missing')

try:
    with open("data_man.txt", "w") as file_man:
        nester.print_lol(man, fh=file_man)
    with open("data_other.txt", "w") as file_other:
        nester.print_lol(other, fh=file_other)

except IOError as err:
    print('File error: ' + str(err))
开发者ID:dlete,项目名称:python_lab,代码行数:30,代码来源:ch04.02.py

示例10: print

                other.append(line_spoken)
        except ValueError:
            pass

    data.close()

except IOError:
    print('The data file is missing')

try:
    with open("data_man.txt", "wb") as file_man:
        pickle.dump(man, file_man)
    with open("data_other.txt", "wb") as file_other:
        pickle.dump(other, file_other)

except IOError as err:
    print('File error: ' + str(err))

try:
    with open('data_man.txt', 'rb') as file_man:
        new_man = pickle.load(file_man)
    with open('data_other.txt', 'rb') as file_other:
        new_other = pickle.load(file_other)
except IOError as err:
    print('File error: ' + err)
except pickleError as perr:
    print('Pickling error: ' + perr)

nester.print_lol(new_man)
nester.print_lol(new_other)
开发者ID:dlete,项目名称:python_lab,代码行数:30,代码来源:ch04.03.pickle.py

示例11:

import nester
movies = ['hello', 'world', 91, ['good', 23, ['morning', 23], 'yes', [23, 45, 0.2, 'large'], 32], ['yesterday']]
nester.print_lol(movies, 0)
nester.print_lol(movies, 1)
nester.print_lol(movies, 2)
开发者ID:hexingb,项目名称:raw,代码行数:5,代码来源:hello.py

示例12: open

import os
import nester

target = ["danile", "michael", ["aj","dk"]]
#print(target)
nester.print_lol(target, True, 3)

print(os.getcwd())

###
data = open("sketch.txt")
for each_line in data:
    try:
        (role, line_spoken) = each_line.split(":")
        #print(each_line, end="")
        print(role, end="")
        print(" said: ", end="")
        print(line_spoken, end="")
    except:
        pass
    
data.close()
开发者ID:gendarme1111,项目名称:PythonDev,代码行数:22,代码来源:test20160109.py

示例13: main

#
# Created:     06-01-2013
# Copyright:   (c) Administrator 2013
# Licence:     <your licence>
#-------------------------------------------------------------------------------

def main():
    pass

if __name__ == '__main__':
    main()
import nester
print(dir(nester))
print(nester.__file__)
cast=['Palin','Cleese','idle','Jones','Gilliam','Chapman']
nester.print_lol(cast)
print("####################################################")
from nester import print_lol
##print(dir(nester))
##print(nester.__file__)
cast=['Palin','Cleese','idle','Jones','Gilliam','Chapman']
print_lol(cast)
print("####################################################")
from nester import *
##print(dir(nester))
##print(nester.__file__)
cast=['Palin','Cleese','idle','Jones','Gilliam','Chapman']
print_lol(cast)
print("####################################################")

开发者ID:linuxwd,项目名称:python-practice,代码行数:29,代码来源:practice.py

示例14: open

import nester
cast = ['Palin','Cleese','Idle','Jone','Gilliam']
try:
     with open ('test.txt','w') as out1:
          nester.print_lol(cast,fh = out1)
except IOError as err:
     print('Error: '+str(err))
开发者ID:Emersonxuelinux,项目名称:PYTHON-,代码行数:7,代码来源:03-excercise2-1.py

示例15:

'''
Created on 2015. 11. 2.

@author: User
'''
import nester

exlist=['plain', 'clese', 'idel', 'gillen', 'eidlfgks', 'chapman']

nester.print_lol(exlist)
开发者ID:sqler21c,项目名称:Python,代码行数:10,代码来源:test.py


注:本文中的nester.print_lol函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。