Census population

! # / User / bin / Python 
# - * - Coding: UTF-. 8 - * -
#. 1, Population Census
DEF get_population ():
RET = []
with Open ( "census", "r", encoding = " 8-UTF ") AS f:
for i in f:
ret.append (i)
return RET
Print (get_population ())
# 2, this is what I wrote 1
DEF get_population1 ():
with Open (" census "," R & lt ", encoding =" UTF-. 8 ") AS F:
for I in F:
the yield I
A = get_population1 ()
Print (A .__ Next __ ())
Print (A .__ Next __ ())
Print (A .__ Next __ ())
Print (a .__ the Next __ ())
Print (a .__ the Next __ ())
Print ( "this is what I wrote ended ----------------------- 1 ------------------------------------- ")
# 3, which is what I wrote 2
population2 DEF ():
with Open ( "census", "R & lt", encoding = "UTF-. 8") AS F:
for I in F:
the yield I
A = population2 ()
Print (Next (A))
Print (Next (a))
Print (the Next (a))
Print (the Next (a))
Print (the Next (a))
Print ( "this is what I wrote 2 ended ////////////// ////////////////////////////////////////////////// /////////////// ")
# 4, which is what I wrote 3
DEF population3 ():
with Open (" census "," r ", encoding = " utf-8 " ) AS f:
for i in f:
yield i
a = population3 ()
for i in a:
Print (i)
Print ( "this is what I wrote 3 ended ============== ================================================== ======== ")

Guess you like

Origin www.cnblogs.com/zhang-da/p/10966889.html