Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Python Unittest
Post: Python Unittest

Hello, I'm new to writing unittests for python scripts below is a function I have written, so that scheduled start time for a Jira ticket can be autoassigned. We only work on deploy tickets from Mond...
roadrage Homework 0 1,640 Feb-14-2019, 06:11 AM
    Thread: rewrite_title
Post: RE: rewrite_title

here is the solution... import re def rewrite_title(hb,nt):     """ Replace the HTML title contents with the given TITLE """     return re.sub(r'(<title>)(.*?)(</title>)',r'\1'+nt+r'\3',...
roadrage Web Scraping & Web Development 12 10,232 Dec-21-2016, 06:47 PM
    Thread: rewrite_title
Post: RE: rewrite_title

how do i group the title tags in regular expression.... I need the same same title tags as per the requirement If regular expressions are grouped something like this; how do i just replace part 2 and...
roadrage Web Scraping & Web Development 12 10,232 Dec-21-2016, 04:21 PM
    Thread: exec_external
Post: RE: exec_external

my outputs need to be interchanged... how to do this...
roadrage Homework 3 4,520 Dec-09-2016, 02:41 AM
    Thread: returncode
Post: returncode

""" Create a function called returncode, taking a single integer argument that would:   1. Cause the program to exit, setting the return code to the value passed     as an argument   2. When inspected...
roadrage Homework 1 4,800 Dec-09-2016, 01:40 AM
    Thread: how do i add new items to a dictionary ?
Post: RE: datastructures...

ok... the appending part seems to be working now... I have modified the code a bit.... def fizz_buzz_advanced(db,ll,ul):     ndb = {}     for i in range(ll,ul):         for k,v in db.items():       ...
roadrage Homework 3 4,804 Dec-08-2016, 07:13 PM
    Thread: how do i add new items to a dictionary ?
Post: how do i add new items to a dictionary ?

""" Create a function called fizz_buzz_advanced. The function should take 3 arguments:    - a dictionary, which maps integer numbers to words, K:W (but could be empty)    - a number describing the sta...
roadrage Homework 3 4,804 Dec-08-2016, 05:52 PM
    Thread: exec_external
Post: exec_external

"""#!/c/Anaconda2/Scripts/python""" """ Create a function called exec_external, taking a single string argument, representing a Linux shell command to be ran. The function must:   1. Execute the shel...
roadrage Homework 3 4,520 Dec-07-2016, 08:10 PM
    Thread: rewrite_title
Post: RE: rewrite_title

I totally agree... my code is the "ugly duckling" at this point... hope "someday" it becomes the "beautiful duck" **smile**
roadrage Web Scraping & Web Development 12 10,232 Dec-07-2016, 07:31 PM
    Thread: rewrite_title
Post: RE: rewrite_title

well... my focus is the"meat and potatoes" of the problem;not the "soups n salads"; your repeated comments about the same problem is nothing but a distraction to my focus of getting things done! my p...
roadrage Web Scraping & Web Development 12 10,232 Dec-07-2016, 06:32 PM
    Thread: rewrite_title
Post: RE: rewrite_title

I don't think me using *args is a blocker to this solution.... all i hear from you is bad practice (but no specific reasoning...why it is bad practice ) there are a million ways of writing programs, a...
roadrage Web Scraping & Web Development 12 10,232 Dec-05-2016, 09:30 PM
    Thread: rewrite_title
Post: rewrite_title

""" Create a function called rewrite_title, taking two arguments:   - String, representing HTML body (full or partial)   - String, representing a new TITLE that must be applied into the HTML The func...
roadrage Web Scraping & Web Development 12 10,232 Dec-05-2016, 08:26 PM
    Thread: list_reduction
Post: list_reduction

""" Write a function called list_reduction, that takes a single argument - a list of strings, L. The function must:   1. Transform the list, *in place* (without returning a new list), so that:     1.1...
roadrage Homework 3 5,013 Dec-05-2016, 05:30 PM
    Thread: loop in system command fails
Post: loop in system command fails

Create a function called filter_passwd. The fucntion must take the following arguments:   - A string, representing the path to a file using the /etc/passwd format (PWD)   - A string, representing the ...
roadrage Homework 1 3,629 Dec-01-2016, 10:27 PM
    Thread: function to write the contents of a webpage into a new file
Post: function to write the contents of a webpage into a...

""" Create a function called wget, which takes a single argument - a fully qualified URL (e.g. https://www.yahoo.com/). The function must:   1. Save the contents returned by that URL (the HTTP respon...
roadrage Homework 4 6,029 Dec-01-2016, 08:37 PM
    Thread: sort_by_length
Post: RE: sort_by_length

(Nov-30-2016, 04:45 PM)Ofnuts Wrote: Question: Why: def sort_by_length(*args):    """ Sort a list by descending length of its elements """    x = args[0]    y = type(x)when you can do the simple...
roadrage Homework 8 7,770 Nov-30-2016, 05:42 PM
    Thread: sort_by_length
Post: sort_by_length

""" Create a function called sort_by_length, which takes a single argument - a (immutable) sequence of iterables (L). The function must:   1. Return a new list, which contains all strings from L, sor...
roadrage Homework 8 7,770 Nov-30-2016, 03:04 AM
    Thread: list to string
Post: RE: list to string

def list2str(*args):     x = args[0]     y = args[1]     p = len(x)     z = ''     for i in range(p):         q = x[i] + y         z+=str(q)     R = str(z)[:-1]     print ("'"+R+"'") a = ['We','are',...
roadrage Homework 5 6,915 Nov-29-2016, 05:31 PM
    Thread: list_split
Post: list_split

""" Create a function called list_split, taking the arguments I (iterable) and N (numeric). The goal of the function would be to split the iterable I into multiple sublists of length N. The function m...
roadrage Homework 3 6,219 Nov-29-2016, 05:30 PM
    Thread: str_format_2var
Post: RE: str_format_2var

This works thank you...
roadrage Homework 4 5,101 Nov-29-2016, 05:28 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020