• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python nester.print_lol函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: print

		try:
			(role, line_spoken) = 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('man_data1.txt', 'w') as manout:
                #print(man, file=manout)
                print_lol(man, output=manout)

        with open('other_data1.txt', 'w') as otherout:
                #print(other, file=otherout)
                print_lol(other, output=otherout)
#        manout = open("man_data.txt", "w")
#        otherout = open("other_data.txt", "w")
#        print(man, file=manout)
#        print(other, file=otherout)
except IOError as err:
        print("Out file error: ", + str(err))
#finally:
#       manout.close()
#        otherout.close()
开发者ID:GracyD,项目名称:HDPython,代码行数:30,代码来源:sketch.py


示例17: open

import nester
man = []
woman = []

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)
            elif role == 'woman':
                woman.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(man, file=man_file)
#    with open('woman_data.txt', 'w') as woman_file:
#        print(woman, file=woman_file)
    with open('man_data.txt', 'w') as man_file, open('woman_data.txt', 'w') as woman_file:
        nester.print_lol(man, fn=man_file)
        nester.print_lol(woman, fn=woman_file)
except IOError as err:
    print('File error: ' + str(err))
开发者ID:howardking,项目名称:Python,代码行数:30,代码来源:sketch7.py


示例18:

import nester

cast = ['Palin', 'Cleese', 'Idle', 'Jones', 'Gilliam', 'Chapman', ["Silicon"]]
nester.print_lol(cast, True)
开发者ID:onecoders,项目名称:PythonBook,代码行数:4,代码来源:test.py


示例19: print

import nester

movies = ["The Holy Grail", 1975, "Terry Jones & Terry Gilliam", 91, 
                ["Graham Chapman", ["Michael Palin", "John Cleese",
                        "Terry Gilliam", "Eric Idle", "Terry Jones"]]]

nester.print_lol(movies)
print('')
nester.print_lol(movies,0)
print('')
nester.print_lol(movies,3)
开发者ID:ueong,项目名称:head_first_python,代码行数:11,代码来源:use_nester_v4.py


示例20: print_lol

from nester import print_lol
cast = ['Palin','Cleese','Idle','Jones','Gillian','Chapman']
print_lol(cast)
开发者ID:igor-storozhev,项目名称:python-tutor,代码行数:3,代码来源:lib-call.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python net.get_hostname函数代码示例发布时间:2022-05-27
下一篇:
Python nest.sli_run函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap