473,387 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

user input and lists

Hi, Python is the first language for me to get into. I'm still really new and have a lot to learn, though...

Does anyone know how to allow users to append lists?

I tried

user.append = raw_input("Type in desired username ")

But apparently .append is read only. D:
Sep 21 '06 #1
4 5782
511 Expert 256MB
you can't do that.

users = []
user = raw_input( "Enter user:")
Sep 22 '06 #2
Oh....Duh, nvm.

I've run into another problem, but from what I've seen, the proper sintax is

user.append(raw_input("Type in desired username "))


I can't properly test it, because (after changing user to a list) my original code directly afterward doesn't work.

if len(user) > 4:

Doesn't work because it's asking how many objects are in the list. D:

I tried

if len(user[0]), too, but to no avail. I think I've discovered a better way to do what I want, so I'm going to revert to user being a simple string, but I'd still like to know.

EDIT: Oh, ok.
Sep 22 '06 #3
511 Expert 256MB
it should be users.append(raw_input("Type in desired username "))
if you declared "users" as a list

len(users) will show how many items are inside the list
Sep 22 '06 #4
I know, but the intention was to find the number of characters in a particular object in the list. A 'no less than five characters' thing.

I don't really need it anymore because I'm changing the way I'm going about this particular problem, but is it possible to do that using the len function on lists?

Thanks for the help, mate.
Sep 22 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Joshua Beall | last post by:
Hi All, What is the best way to use a cookie to remember a logged in user? Would you store the username and password in two separate cookies? Should the password be plain text? Hashed? Not...
by: Ken Fine | last post by:
(originally posted to one of macromedia's groups; no help, so hopefully someone here can help me out. I'm using VBScript ASP.) When designing administrative interfaces to websites, we often need...
by: Raffi | last post by:
Hi folks, I'm new to JavaScript and need some help. I have a form with a select field. Depending on what is selected in this field, I want to display or not display another select field. For...
by: zlst | last post by:
Many technological innovations rely upon User Interface Design to elevate their technical complexity to a usable product. Technology alone may not win user acceptance and subsequent marketability....
by: JDC | last post by:
Hi all, I thought I understood the page lifecycle. but I guess not. I have a couple of pages with similar GridViews and each is connected to a ObjectDataSource. Both pages have an identical set...
by: Olivier | last post by:
Dear all, Some background first: I have a gtk window where my user pushes some buttons with a definite pleasure. It usually amounts to asking the program to try all possible permutations which...
by: Rajen | last post by:
Suppose the field length is 25 characters. After entering the 25th character, it should be available to process. Program should not wait for the user to press enter/return key. Thank you.
by: Bels | last post by:
I am currently designing a real estate website using Dreamweaver CS3, php, MySQL on a Mac. On it is a 'property search' form that queries the property database. The form consists of 5 dropdown lists....
by: sebastian | last post by:
Can this be done without client-side scripting? I thought sessions might be the answer but after some testing found that sometimes the old session data remained even after the user left the site...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.