beginning ruby from novice to professional

Want to know beginning ruby from novice to professional? we have a huge selection of beginning ruby from novice to professional information on alibabacloud.com

Beginning python from Novice to Professional (2)-command line run Python script

Command line run Python scriptLinux first create a hello.py[Python] View PlainCopy $ gedit hello.py Input:[Python] View PlainCopy #!/usr/bin/env python Print 2 Save exit, run:[Python] View PlainCopy $ python hello.py 4 We can also make it perform like a normal programBefore executing, let the script file have the executable properties:[Python] View PlainCopy $ chmod a+x hello.py To run the script:[Python] View PlainCopy $.

Beginning Python from Novice to Professional (5)-conditions and loops

Conditions and loopsConditional execution:Name = Raw_input (' What's your name? ' If Name.endswith (' Gumby '):p rint ' Hello, Mr.gumby 'What is your name? Gumbyhello, Mr.gumbyName = Raw_input (' What's your name? ' If Name.endswith (' Gumby '):p rint ' Hello, mr.gumby ' else:print ' Hello, stranger 'Multiple conditions:num = input (' Enter a number: ') if num > 0:print ' The number is positive ' elif num Enter a number:5the number is positiveEnter A number: -1the number is negativeEnter a numbe

Beginning Python From Novice to Professional (8)-file Method

Beginning Python From Novice to Professional (8)-file Method File Method Read/write: #!/usr/bin/env pythonf = open('somefile.txt','w')f.write('Hello,')f.write('World!')f.close()f = open('somefile.txt','r')print f.read(5) HelloBasic file method: #!/usr/bin/env pythonf = open(r'somefile.txt')print f.read()f.close()f = open(r'somefile.txt')for i in range(3):print

Beginning Python From Novice to Professional (5)-conditions and loops

Beginning Python From Novice to Professional (5)-conditions and loops Conditions and loops Conditional execution: name = raw_input('What is your name? ')if name.endswith('Gumby'):print 'Hello, Mr.Gumby' What is your name? GumbyHello, Mr.Gumby name = raw_input('What is your name? ')if name.endswith('Gumby'):print 'Hello, Mr.Gumby'else:print 'Hello, stranger'Multi

Beginning Python From Novice to Professional (3)-List Operation, pythonnovice

Beginning Python From Novice to Professional (3)-List Operation, pythonnovice List operations List function: >>> list('hello')['h', 'e', 'l', 'l', 'o']Change List: >>> x=[1,1,1]>>> x[1]=2>>> x[1, 2, 1]Delete element: >>> names = ['wu','li','zhao','qian']>>> del names[1]>>> names['wu', 'zhao', 'qian']Partition assignment: >>> name = list('perl')>>> name['p'

Beginning Python From Novice to Professional (2)-run the Python script on the command line, novicepython

Beginning Python From Novice to Professional (2)-run the Python script on the command line, novicepython Run the Python script on the command line. Create a hello. py file in Linux $ Gedit hello. py Input: #! /Usr/bin/env pythonprint 2 + 2Save and exit. Run: $ Python hello. py 4We can also make it run like a common program. Before Execution, le

Beginning Python From Novice to Professional (9)-Socket, pythonnovice

Beginning Python From Novice to Professional (9)-Socket, pythonnovice Socket Small servers: #!/usr/bin/env pythonimport sockets = socket.socket()host = socket.gethostname()port = 1234s.bind((host,port))s.listen(5)while True:c,addr = s.accept()print 'Got connection from',addrc.send('Thank you for connecting')c.close()Small client: #!/usr/bin/env pythonimport so

Beginning Python from Novice to Professional (3)-list operation

', ' little ', ' dog ']>>> sentence.index (' Little ') 3Insert inserts an object into the list:>>> num = [1,2,3,5,6,7]>>> num.insert (3, ' four ') >>> num[1, 2, 3, ' Four ', 5, 6, 7]Pop removes the list element, the last one by default:>>> x = [1,2,3]>>> x.pop () 3>>> x[1, 2]>>> x.pop (0) 1>>> x[2]Combined Append:>>> x = [1,2,3]>>> x.append (X.pop ()) >>> x[1, 2, 3]Remove removes the first occurrence from the list:>>> x = [' To ', ' is ', ' or ', ' not ', ' to ', ' is ']>>> x.remove (' is ') >>

Beginning Python from Novice to Professional (4)-Demo sample format string

$ gedit price.py#!/usr/bin/env pythonwidth = input (' Please enter width: ') price_width = 10item_width = Width-price_widthheader_format = '%-*s%*s ' format = '%-*s%*.2f ' print ' = ' * widthprint header_format% (item_width, ' item ', Price_width, ' price ') print ' -' * widthprint format% (item_width, ' Apples ', price_width,0.4) print format% (item_width, ' Pears ', price_width,0.5) print Format% (item_width, ' cantaloupes ', price_width,1.92) print format% (item_width, ' apricots ', pr

Beginning Python From Novice to Professional (1)-numbers and expressions, pythonnovice

Beginning Python From Novice to Professional (1)-numbers and expressions, pythonnovice Numbers and expressions Addition, subtraction, multiplication, division: >>> 2 + 24 >>> 100-5050 >>>> 3*515 >>>> 1/20/2.00.5Remainder and multiplication: >>> 1% 21 >>> 10% 31 >>> 2 ** 38 >>>-3 ** 2-9 >>> (-3) ** 29Hexadecimal, octal: >>> 0xff255 >>> 02016Variable

Beginning Python from Novice to Professional (3)-list operation

] >>> X.append (X.pop ()) >>> x [1, 2, 3] Remove removes the first occurrence from the list:[Python] View PlainCopy >>> x = [' to ',' is ', 'or ',' not ',' to ',' is '] >>> x.remove (' be ') >>> x [' to ', ' or ', ' no ', ' to ', ' being '] Reverse Reverse storage elements:[Python] View PlainCopy >>> x = [1,2,3] >>> X.reverse () >>> x [3, 2, 1] Sort order:[Python] View PlainCopy >>> x = [4,6,2,1,7,9]

How to select a host at the beginning of a novice SEO station

Site optimization of the beginning of the first need to optimize the site is also the choice of host to work hard, good host can make your later SEO effort, poor main opportunity to make you mental haggard, even the impact of the site is disastrous. The following is the odd Fox SEO to novice host to choose a few suggestions, opinion for reference only. First, try to choose the credibility of more trustwort

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.