Results 1 to 3 of 3

Thread: Python help

  1. #1
    Join Date
    Apr 2011
    Location
    Chittagong,Bangladesh
    Beans
    142
    Distro
    Ubuntu 12.04 Precise Pangolin

    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
    3,645
    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 you get a satisfactory answer to your problem, mark the thread as [SOLVED]. Thanks (How-to)

  3. #3
    Join Date
    Dec 2012
    Beans
    173

    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
  •