01-06-2009
Python, keep successively increasing longer list
Suppose I have a
listname=["john" "mary" "anne" "lisa"]
I want to generate the following as output
john
john mary
john mary anne
john mary anne lisa
Is there any way to do this?
print listname[0]
print listname[0] listname[1]
print listname[0] listname[1] listname [2]
.......
what is a smart way of putting this into a loop structure? Thanks.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hello,
I have a file with over 100,000 lines. I would like to be able extract 5000 lines at a time and give it as an input to another program.
sed -n '1,5000p' <myfile> > myOut
Similarly for
5001-10000
10001-15000
....
How can I do this in a loop?
Thanks,
Guss (5 Replies)
Discussion started by: Gussifinknottle
5 Replies
2. Shell Programming and Scripting
I have a file command.txt. It's content are as follows:-
The content of file is actually a command with script name and respective arguments.
arg1 and arg2 are dummy arguments , format : -arg arg_value
test is a argument specifying run mode , format : -arg
In my python code, i read it and... (1 Reply)
Discussion started by: animesharma
1 Replies
3. UNIX for Dummies Questions & Answers
Hi !
It is a general question.
When an awk script looks like:
#! bin/awk
function example(i){
<body>
}
{
example(1) #the function uses input_1 and return output_a
}
{
example(2) #the function uses previous output_a as an input and returns... (15 Replies)
Discussion started by: beca123456
15 Replies
4. UNIX for Dummies Questions & Answers
Hello,
I have several hundred subdirectories which contain input files for a binary executable. I need to get into each of the subdirectories, run the executable and then move to the next one and repeat the process. What is the best way to do this?
Arbitrarily my file structures look like... (3 Replies)
Discussion started by: Gussifinknottle
3 Replies
5. Shell Programming and Scripting
Hi guys,
I'm trying to search for several strings, which I have in a .txt file line by line, on another file.
So the idea is, take input.txt and search for each line in that file in another file, let's call it rules.txt.
So far, I've been able to do this, to search for individual strings:
... (1 Reply)
Discussion started by: starriol
1 Replies
6. Shell Programming and Scripting
I have few list value which are shown as below and want to print the same to a text file in python.
But I couldn't able to write to a file.
Could anyone please help me how to print the list with tuples to a file .
My code:
======
fout=open('output.txt','w')
mylist =
fout.write()... (1 Reply)
Discussion started by: scriptscript
1 Replies
7. Programming
Here is a snippet of my code:
blahblahblah...
blah
for link in goodies.soup.find_all('a'):
blah.append(link.get('href'))
blah=list(set(blah))
which gives my list of urls. So now I use a regex to search for the relevant urls which I want in a list:
for r... (0 Replies)
Discussion started by: metallica1973
0 Replies
8. Post Here to Contact Site Administrators and Moderators
Is it just me or are the links to LinkedIn on the "Members" list not working any more? Clicking on Facebook, YouTube, etc work just fine.
I'm getting a 404 error (page no longer exists) but I know for sure that my page is there. Perhaps there's something wrong with my browser? Any ideas? (7 Replies)
Discussion started by: hicksd8
7 Replies
9. Shell Programming and Scripting
Hello!
#!/usr/bin/env python
hn = "simsa-svr"
for container in containerslist:
Name = container
I want to print Name along with hn i,e simsa-svr. I tried like Name = container'-'.join(hn) did not work.
Needed result: lilly2232321-simsa-svr (2 Replies)
Discussion started by: ashokvpp
2 Replies
10. Programming
I have a list as follows:
From this i need to grep the element using keyword as "primary" and return output as
12:13-internet-wifi-primary
i used as follows
if (i <= (len(system_info))):
ss = system_info
print... (5 Replies)
Discussion started by: Priya Amaresh
5 Replies
LEARN ABOUT DEBIAN
xpausers
xpausers(7) SAORD Documentation xpausers(7)
NAME
XPAUsers - Distinguishing Users
SYNOPSIS
XPA normally distinguishes between users on a given host, but it is possible to send data to access points belonging to other users.
DESCRIPTION
A single XPA name service typically serves all users on a given machine. Two users can register the same XPA access points on the same
machine without conflict, because the user's username is registered with each access point and, by default, programs such as xpaget and
xpaset only process access points of the appropriate user. For example:
XPA xpa1 gs 838e2f67:1262 eric
XPA xpa2 gs 838e2f67:1266 eric
XPA xpa1 gs 838e2f67:2523 john
XPA xpa2 gs 838e2f67:2527 john
Here the users "eric" and "john" both have registered the access points xpa1 and xpa2. When either "john" or "eric" retrieves information
from xpa1, they will process only the access point registered in their user name.
If you want to access another user's XPA access points on a single machine, use the -u [user] option on xpaset, xpaget, etc. For example,
if eric executes:
xpaget -u john xpa1
he will access John's xpa1 access point.Use "*" to access all users on a given machine:
xpaget -u "*" xpa1
Note that the XPA Environment Variable XPA_NSUSERS can be used to specify the default list of users to process:
setenv XPA_NSUSERS "eric,john"
will cause access points from both "eric" and "john" to be processed by default.
SEE ALSO
See xpa(7) for a list of XPA help pages
version 2.1.14 June 7, 2012 xpausers(7)