Sponsored Content
Top Forums Programming Search or find a element inside list python Post 303033242 by Priya Amaresh on Tuesday 2nd of April 2019 04:54:37 AM
Old 04-02-2019
Search or find a element inside list python

I have a list as follows:
Code:
[u'12:13-internet-wifi-primary', u'26:27-broadcom-wifi']


From this i need to grep the element using keyword as "primary" and return output as

Code:
12:13-internet-wifi-primary

i used as follows
Code:
                    if (i <= (len(system_info['Ad_List']))):
                        ss = system_info['Ad_List']
                        print type(ss)
                        searchObj = "primary"
                        #if 'primary' in ss:
                        if any(word in searchObj for word in ss):
                            print "inside if"
                            print searchObj
                        else:
                            print "inside else... No search obj"

Always it gets into else part.. Smilie
How to do it.. split,find are not list attributes
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk search for a element in the list of strings

Hi, how do I match a particular element in a list and replace it with blank? awk 'sub///' $FILE list="AL, AK, AZ, AR, CA, CO, CT, DE, FL, GA, HI, ID, IL, IN, IA, KS, KY, LA, ME, MD, MA, MI, MN, MS, MO, MT, NE, NV, NH, NJ, NM, NY, NC, ND, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VT, VA, WA,... (2 Replies)
Discussion started by: grossgermany
2 Replies

2. UNIX for Dummies Questions & Answers

script to search patterns inside list of files

>testfile while read x do if then echo $x >> testfile else fi if then echo $x >> testfile else fi done < list_of_files is there any efficient way to search abc.dml and xyz.dml ? (2 Replies)
Discussion started by: dr46014
2 Replies

3. Shell Programming and Scripting

Need to find root element name of XML file

Given this XML: <?xml version="1.0"?> <catalog> <cd> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> </cd> <cd> <title>Hide your heart</title> ... (2 Replies)
Discussion started by: ricksj
2 Replies

4. Shell Programming and Scripting

Find if XML element has a matching required element

I want to check if every <Part> element has corresponding <Description> in this sample XML. ....<Lot Of XML> <Inv lineNumber="2"> <Item> ... (4 Replies)
Discussion started by: kchinnam
4 Replies

5. Shell Programming and Scripting

awk Search Array Element Return Index

Can you search AWK array elements and return each index value for that element. For example an array named car would have index make and element engine. I want to return all makes with engine size 1.6. Array woulld look like this: BMW 1.6 BMW 2.0 BMW 2.5 AUDI 1.8 AUDI 1.6 ... (11 Replies)
Discussion started by: u20sr
11 Replies

6. Shell Programming and Scripting

Find first n element by matching IDs

Hi All I have a problem that I am not able to resolve. Briefly, I have a file like this: ID_1 10 ID_2 15 ID_3 32 ID_4 45 ID_5 66 ID_6 79 ID_7 88This file is numerically ordered for the 2th column. And another file containing a list of IDs(just one in this example) ID_4What I... (7 Replies)
Discussion started by: giuliangiuseppe
7 Replies

7. Shell Programming and Scripting

sed command inside paramiko python

Hi I am trying to execute a sed command inside paramiko which finds and deletes the particular string from a file But sed command doesnt work inside paramiko python machine=qwe dssh = paramiko.SSHClient() dssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) try: ... (4 Replies)
Discussion started by: Priya Amaresh
4 Replies

8. Shell Programming and Scripting

Find common values in python list in ordered format

Hello All, There are various codes available to find the intersection between two sets in python. But my case is the following: I want to find the continual common pattern in different lists compared to list1. (i have underlined the longest common patterns in set a and set b) a = 2, 3, 5,... (1 Reply)
Discussion started by: Zam_1234
1 Replies

9. Shell Programming and Scripting

How to insert a CSV within xml element tag using Python?

Hi Team, I have a CSV file which I have to read through and needs to insert the content within an XML file using Python ONLY ( as most of the code base we have in python only). I managed to find the first part, missing how to insert to XML under "specific" tags. cat input.csv... (0 Replies)
Discussion started by: panyam
0 Replies

10. Programming

Create a C source and compile inside Python 1.4.0 to 3.7.0 in Python for ALL? platforms...

Hi all... As you know I like making code backwards compatible for as many platforms as possible. This Python script was in fact dedicated for the AMIGA A1200 using Pythons 1.4.0, 1.5.2, 1.6.0, 2.0.1, and 2.4.6 as that is all we have for varying levels of upgrades from a HDD and 4MB FastRam... (1 Reply)
Discussion started by: wisecracker
1 Replies
wifi-radar(1)						      General Commands Manual						     wifi-radar(1)

NAME
WiFi Radar - utility for managing WiFi profiles SYNOPSIS
wifi-radar [OPTION]... DESCRIPTION
WiFi Radar is a PyGTK2 utility for managing WiFi profiles. It will look for the config file in /etc/wifi-radar/wifi-radar.conf. You can change that in wifi-radar. If the configuration file does not exist, it will create it, so you must always run it within a correctly permitted account (as root or use sudo or pam). Recent versions partially implement WPA-TKIP with wpa_supplicant. You need a running wpa_supplicant installation with a /etc/wpa_suppli- cant/wpa_supplicant.conf file. Then by setting in your /etc/wifi-radar/wifi-radar.conf file the "use_wpa = yes" option and "wpa_driver = ipw" for example, wpa_supplicant will be launched when you connect using this profile. But currently you can't set your wpa_supplicant options like the psk, proto, key_mgmt etc. using wifi-radar. Your wpa_supplicant configu- ration file should be set and tested already. If you have different networks set in wpa_supplicant.conf, then you can switch using wifi- radar. The wifi-radar script accepts the following command-line options: OPTIONS
-v, --version for printing the version. FILES
/etc/wifi-radar/wifi-radar.conf See for more information. BUGS
Probably lots! Because of repeated scanning, WiFi Radar is very power consuming. Please report bugs to the mailing list <https://lists.anl.gov/mailman/listinfo/wifi-radar> MORE INFORMATION
The GIT repository is available at https://git.berlios.de/cgi-bin/gitweb.cgi?p=wifi-radar;a=summary If you have questions, visit http://wifi-radar.berlios.de AUTHOR
This Python program was originally written by Ahmad Baitaimal <ahmad@bitbuilder.com>. It has been maintained at various times by Brian Elliott Finley <brian@thefinleys.com> and Sean Robinson <seankrobinson@gmail.com>. Contributions have been provided by: o Douglas Breault <genkreton@comcast.net> o Nicolas Brouard <nicolas.brouard@libertysurf.fr> o Gary Case <gcase@redhat.com> o Jon Collette <jonc@etelos.com> o David Decotigny <com.d2@free.fr> o Simon Gerber <gesimu@gmail.com> o Joey Hurst <jhurst@lucubrate.org> o Ante Karamatic <ivoks@ubuntu.com> o Richard Monk <rmonk@redhat.com> o Kevin Otte <kotte@redhat.com> o Nathanael Rebsch <nathanael@dihedral.de> o Andrea Scarpino <andrea@archlinux.org> o Patrick Winnertz <winnie@debian.org> SEE ALSO
wifi-radar.conf(5) wpa_supplicant(8) WiFi Radar 2.0 July 2009 wifi-radar(1)
All times are GMT -4. The time now is 07:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy