Exemple #1
0
            lines = len(string1)

            print("no.of bytes in file", byte)
            print("no.of words in file", words)
            print("no.of lines in file", lines)

            f1.close()
        else:
            print("file is not present")
    else:
        print("invalid number of argument")

#open a file write and read in the fileif(1):
if (0):
    if (len(sys.argv) == 2):
        f1 = open(sys.argv[1], 'w+')
        #		string = input("enter the string to write into file\n") #this works only python3
        string = raw_input("enter the string to write into file\n")
        f1.write(string)
        f1.seek(0)
        print(f1.read())

        f1.close()
    else:
        print("invalid number of argument")

if (1):
    print(phone.isdn())
    print(phone.pots())
    print(phone.g3())
Exemple #2
0
#!/usr/bin/python
import phone
phone.pots()
phone.isdn()
phone.g3()
Exemple #3
0
print Money
AddMoney()
print Money

func_hello = dir(mod_hello)
func_math = dir(math)

print "Functions in module func_hello :- ", func_hello
print "Functions in module func_math :- ", func_math

print math.__name__
print math.__doc__
print math.__file__

print mod_hello.__name__
print mod_hello.__doc__
print mod_hello.__file__

print "local functions :- \n", locals().keys(), "\n"
print "global functions :- \n", globals().keys()


print "PYTHON PACKAGES"
import phone

phone.pots()
phone.isdn()
phone.g3()

print "P218 -> ch 15 Good Bye"