Sponsored Content
Full Discussion: Python Newbie Question Regex
Top Forums Shell Programming and Scripting Python Newbie Question Regex Post 302776747 by Chubler_XL on Wednesday 6th of March 2013 06:58:57 PM
Old 03-06-2013
You could also try:

Code:
refound = re.search('\d{5,6}(?=&amp)', link)

if refound:
    vidurl   = "http://www.blahblah.com/home/GetPlayerXML.aspx?lpk4=%s" % refound.group(0)


Last edited by Chubler_XL; 03-06-2013 at 08:11 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Newbie Regex Question

Hello, I am trying to use the CDE File Manager in AIX to filter out files that I want to be hidden in the file manager. It gives me a script box that I can supposedly enter a regex into if I want to filter out additional file types. Example: "Also Hide:"_______________ I can put... (0 Replies)
Discussion started by: ciremg01
0 Replies

2. Programming

NEWBIE QUESTION: python 3 or 2.6.x

I'm a newbie and want to learn a programming language, willy-nilly I picked python... Should I go with 2.6.x which at first glance seems extremely well documented, or should I go with 3.0, which is new and shiny?! I want...no...I'm going to NEED fantastic documentation or I'm going to fail... (2 Replies)
Discussion started by: guptaxpn
2 Replies

3. UNIX for Dummies Questions & Answers

UNIX newbie NEWBIE question!

Hello everyone, Just started UNIX today! In our school we use solaris. I just want to know how do I setup Solaris 10 not the GUI one, the one where you have to type the commands like ECHO, ls, pwd, etc... I have windows xp and I also have vmware. I hope I am not missing anything! :p (4 Replies)
Discussion started by: Hanamachi
4 Replies

4. Shell Programming and Scripting

Python Regex

I have the below string and regex. However I cant understand why it works the way it does. IP has been changed for safety ;) String = NowSMS Error Report. Error initializing SMSC Interface 'SMPP - 10.15.8.10:17600'. Interface is not available. Regex = (.+\.)\s(.+) I get two... (1 Reply)
Discussion started by: barney34
1 Replies

5. Shell Programming and Scripting

Perl newbie - regex replace all groups issue

Hello, Although I have found similar questions, I could not find advice that could help with my problem. The issue: I am trying to replace all occurrences of a regex, but I cannot make the regex groups work together. This is a simple input test file: The Vedanta Philosophy... (3 Replies)
Discussion started by: samask
3 Replies

6. Shell Programming and Scripting

Newbie Python Url Scraper

I setup Zoneminder and have been playing around with setting up a couple of Wanscam PTZ ip cameras in which I have been running into road blocks with streaming and etc. I cant find much information on the camera and its webserver that sits on it and wanted to get a an absolute directory structure... (5 Replies)
Discussion started by: metallica1973
5 Replies

7. Programming

Python Reading Individual files and Regex through them

As a newbie to Python, I am trying to write a script in which is will add all the log files (*.log) from within a directory to a list, open the files and search for an ip using a regex and single it out (appending the ip's to the list). So far, I have: import re, os def list_files() content = ... (4 Replies)
Discussion started by: metallica1973
4 Replies

8. Shell Programming and Scripting

Python Regex Removing One Too Many...

Well, I'm a python noob and my last post here I was introduced to Regex. I thought this would be easy since I knew Regex with Bash. However, I've been banging my head a while to extract an ip address from ifconfig with this: #!/usr/bin/python import re import subprocess from subprocess... (5 Replies)
Discussion started by: Azrael
5 Replies

9. Programming

Python Regex List Creation

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

10. Shell Programming and Scripting

Python with Regex and Excel

Hello I have a big excel file for Ticket Data Analysis. The idea is to make meaningful insight from Resolution Field. Now as people write whatever they feel like while resolving the ticket it makes quite a task. 1. They may or may not tag it with something like below within the resolution... (1 Reply)
Discussion started by: radioactive9
1 Replies
PYTHON(1)						    BSD General Commands Manual 						 PYTHON(1)

NAME
python, pythonw -- an interpreted, interactive, object-oriented programming language SYNOPSIS
python ... pythonw ... DESCRIPTION
To support multiple versions, the programs named python and pythonw now just select the real version of Python to run, depending on various settings. (As of Python 2.5, python and pythonw are interchangeable; both execute Python in the context of an application bundle, which means they have access to the Graphical User Interface; thus both can, when properly programmed, display windows, dialogs, etc.) The current supported versions are 2.6 and 2.7, with the default being 2.6. Use % man python2.6 % man python2.7 % man pythonw2.6 % man pythonw2.7 to see the man page for a specific version. Without a version specified, % man pydoc and the like, will show the man page for the (unmodified) default version of Python (2.6). To see the man page for a specific version, use, for example, % man pydoc2.7 CHANGING THE DEFAULT PYTHON
Using % defaults write com.apple.versioner.python Version 2.7 will make version 2.7 the user default when running the both the python and pythonw commands (versioner is the internal name of the version- selection software used). To set a system-wide default, replace 'com.apple.versioner.python' with '/Library/Preferences/com.apple.versioner.python' (admin privileges will be required). The environment variable VERSIONER_PYTHON_VERSION can also be used to set the python and pythonw version: % export VERSIONER_PYTHON_VERSION=2.7 # Bourne-like shells or % setenv VERSIONER_PYTHON_VERSION 2.7 # C-like shells % python ... This environment variable takes precedence over the preference file settings. 64-BIT SUPPORT Versions 2.6 and 2.7 support 64-bit execution (which is on by default). Like the version of Python, the python command can select between 32 and 64-bit execution (when both are available). Use: % defaults write com.apple.versioner.python Prefer-32-Bit -bool yes to make 32-bit execution the user default (using '/Library/Preferences/com.apple.versioner.python' will set the system-wide default). The environment variable VERSIONER_PYTHON_PREFER_32_BIT can also be used (has precedence over the preference file): % export VERSIONER_PYTHON_PREFER_32_BIT=yes # Bourne-like shells or % setenv VERSIONER_PYTHON_PREFER_32_BIT yes # C-like shells Again, the preference setting and environmental variable applies to both python and pythonw. USING A SPECIFIC VERSION
Rather than using the python command, one can use a specific version directly. For example, running python2.7 from the command line will run the 2.7 version of Python, independent of what the default version of Python is. One can use a specific version of Python on the #! line of a script, but that may have portability and future compatibility issues. Note that the preference files and environment variable that apply to the python command, do not apply when running a specific version of Python. In particular, running python2.6 will always default to 64-bit execution (unless one uses the arch(1) command to specifically select a 32-bit architecture). SEE ALSO
python2.6(1), python2.7(1), pythonw2.6(1), pythonw2.7(1), arch(1) BSD
Aug 10, 2008 BSD
All times are GMT -4. The time now is 11:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy