Results 1 to 3 of 3

Thread: Python help

  1. #1
    Join Date
    Apr 2011
    Location
    Chittagong,Bangladesh
    Beans
    148
    Distro
    Ubuntu 14.04 Trusty Tahr

    Python help

    How to input two numbers using space like [ 4<space>8] in two list type variables ?

  2. #2
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,330
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Python help

    you should be more specific
    input as in user input?
    is [4 8] supposed to produce separate [4] and [8] or what?
    if your question is answered, mark the thread as [SOLVED]. Thx.
    To post code or command output, use [code] tags.
    Check your bash script here // BashFAQ // BashPitfalls

  3. #3
    iMac71 is offline Gee! These Aren't Roasted!
    Join Date
    Dec 2012
    Beans
    171

    Re: Python help

    perhaps the following code is what you're looking for (I assume that you use python 2.7.3):
    PHP Code:
    from string import split
    list1
    list2 = [[float(num)] for num in split(raw_input())]
    print 
    list1list2 
    Last edited by iMac71; March 7th, 2013 at 06:05 PM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •