text
stringlengths
226
34.5k
How to run a Python script in Node.js synchronously? Question: I am running the following Python script in Node.js through [python- shell](https://github.com/extrabacon/python-shell): import sys import time x=0 completeData = ""; while x<800: crgb = ""+x; print crgb ...
Why does my break call the previous function Question: I have two functions and the first one calls the second one. However, when I break out of the second function it displays text from an if statement in the first function. What I don't understand, is why is the second function calling the first? Secondly, I do not u...
Python Scapy output to txt file Question: **I would like to output just IP.dst to txt file, But I get all the packet info including Ether, src, etc** from scapy.all import * import time import os file = open("newfile.txt","w") t = '%IP.dst%' p = sniff(filter="ip", prn=lambda x:x.sprin...
Create list of list in python Question: Suppose I have three lists [-1,0,1,2] [0,1] [a,b,c] I would like to obtain a list as [-1,0,a] [-1,0,b] [-1,0,c] [-1,1,a] [-1,1,b] [-1,1,c] [0,0,a] [0,0,b] [0,0,c] ... How to write a py...
Difference between scikit-learn and sklearn Question: On OS X 10.11.6 and python 2.7.10 I need to import from sklearn manifold. I have numpy 1.8 Orc1, scipy .13 Ob1 and scikit-learn 0.17.1 installed. I used pip to install sklearn(0.0), but when I try to import from sklearn manifold I get the following: > Traceback (...
How do I make button press first stopping a playing audio file and then playing its own audio? Question: My problem is, that the audio files under each button are quite lengthy and if I pressed the wrong button, I would have to wait it to play to end. How can I make every button press to 1) stop the possible playing au...
Python: count specific occurrences in a dictionary Question: Say I have a dictionary like this: d={ '0101001':(1,0.0), '0101002':(2,0.0), '0101003':(3,0.5), '0103001':(1,0.0), '0103002':(2,0.9), '0103003':(3,0.4), '0105001':(1,0.0), '0105002':(2,1.0), '0105003':(3,0.0...
Sentry django configuration - logger Question: I am trying to use simple logging and want to send errors/exceptions to Sentry. I configured the Sentry as per the document and run the test successfully on my dev(`python manage.py raven test`) I added the Logging configuration as in [Sentry documentation](https://docs....
why use sqlalchemy declarative api? Question: New to sqlalchemy and somewhat novice with programing and python. I had wanted to query a table. It seems I can use the all() function when querying but cannot filter without creating a class. 1.) Can I filter without creating a class and using the declarative api? Is the ...
format date 'Fri Apr 15 04_01_33 2016' and '2015-12-16 22-39-28' Using python datetime format date Question: Here is Simples way to format date using datetime from datetime import datetime date = '2016-04-07 04-54-53' date1 = 'Fri Apr 15 04_01_33 2016' format = "%Y-%m-%d %H-%M-%S" format1...
Cannot see prints with python-tensorflow Question: I have the following program written in python: import tensorflow as tf def main(_): print(something) if **name** == 'main': tf.app.run() Either running it with bazel or not, I cannot see the output of print function. Why? Answer: I think the problem is with the ...
Web Scraping a Forum Post in Python Using Beautiful soup and lxml Cannot get all posts Question: Im having an issue that is driving me absolutely crazy. I am a newbie to web scraping, and I am practicing web scraping by trying to scrape the contents of a forum post, namely the actual posts people made. I have isolated ...
simplest python equivalent to R's grepl Question: Is there a simple/one-line python equivalent to R's `grepl` function? strings = c("aString", "yetAnotherString", "evenAnotherOne") grepl(pattern = "String", x = strings) #[1] TRUE TRUE FALSE Answer: You can use list comprehension: ...
How come when I import of two functions from the same module, the import works only for one the two? Question: **Intro** I am running a python script on an cluster. I run everything in virtualenv and in the code I am importing two functions from the same module (written in SC_module.py): ex. SC_module.py ...
Django: 'BaseTable' object does not support indexing Question: I'm migrating my project to Django 1.8 and I am receiving an error related to 'johnny cache. Specifically in 'johnny/cache.py/'. **Error:** lib/python2.7/site-packages/johnny/cache.py", line 87, in get_tables_for_query tables = set([v[0] for v in getattr(q...
seaborn violin plot, how can I set labels? Question: I'm plotting a list of vectors as a sequence of violin plots. I'd use a pandas dataframe, but the lists are unequal lengths. This works: `python g = sns.violinplot (data=res, cut=0, inner='box') ` where 'res' is a list of lists (each a vector of floats), where each...
django deploy - ubuntu 14.04 and apache2 Question: <https://www.sitepoint.com/deploying-a-django-app-with-mod_wsgi-on- ubuntu-14-04/> and <https://www.youtube.com/watch?v=hBMVVruB9Vs> This was the first time I deploy a website.And these are the tutorials I followed. Now I can access to the server(by typing 10.231.X...
Python 3 - Tkinter button commands Question: I am new to Tkinter and Python as well. I have three buttons with commands in my Tkinter frame. Button 1 calls open_csv_dialog(), opens a file dialog box to select a .csv file and returns the path. Button 2 calls save_destination_folder(), opens a file dialog box to open the...
pysnmp error on specific query Question: I have been trying to implement code that loads my device MIBS and walks through all the OIDS. In this one case when I try to load the OID for snmp 1.3.6.1.2.1.11 smi throws an exception when trying to load a specific OID. The previous OID works successfully: '.1.3.6.1.2.1.11.29...
Python 2.7 on OS X: TypeError: 'frozenset' object is not callable on each command Question: I have this error on each my command with Python: ➜ /tmp sudo easy_install pip Traceback (most recent call last): File "/usr/bin/easy_install-2.7", line 11, in load_entry_point('setuptools==1.1...
remove extra newline when writing to a file Question: This little script writes keywords to a file, but adds an extra newline between each keyword. How do I make it stop? I.e. instead of Apple Banana Crayon I want Apple Banana Crayon I tried Googling ...
Python: subprocess call doesn't recognize * wildcard character? Question: I want to remove all the *.ts in file. `os.remove` didn't work. And this doesn't expand `*` >>> args = ['rm', '*.ts'] >>> p = subprocess.call(args) rm: *.ts No such file or directory Answer: The `rm` program takes a...
converting char to list in R Question: I wrote a python script for reading mails' content and append to list and calling this python script in R. The problem is R is considering the list as one instead of two elements in it. Here is my python script: { import sys import string import glob ...
docker container not able to write on host machine Question: If I run the following code, I can convert the csv file into a format that I require. import csv import json csvfile = open('/tmp/head.csv', 'r') jsonfile = open('/tmp/file.json', 'w') fieldnames = ("user","messageid",...
Python - dig ANY equivalent with scapy module Question: I want to use the python module scapy to perform an equivalent command of dig ANY google.com @8.8.4.4 +notcp I've made a simple example code: from scapy.all import * a = sr(IP(dst="8.8.4.4")/UDP(sport=RandShort(),dport=...
Write dictionary to csv with one line per value Question: I am quite new to Python so please excuse me if this is a really basic question. I have a Python dictionary such as this one: `foo = {'bar1':['a','b','c'], 'bar2':['d','e']}` I would like to write it to a csv file, with one line per **value** and the key as fi...
python edge detector - mask the area were it's completly black Question: I have used canny edge detector on an image. It detected some areas in the image and other areas it displays nothing. Now, I want that on the original image it would mask the areas that were completely black. How can I do it? I am using python an...
Cant access instance variable from another class Question: I have checked many questions replied here, but can't access an instance variable from another class(I have tried [this](http://stackoverflow.com/questions/19993795/how-would-i-access- variables-from-one-class-to-another) as example) #in file: vi...
Installing a package in Conda environment, but only works in Python not iPython? Question: I am using an Ubuntu docker image. I've installed Anaconda on it with no issues. I'm not trying to install tensorflow, using the directions on the tensorflow website: conda create --name tensorflow python=3.5 s...
Python: How to detect a particular number inside a long serial number Question: I have been working on this project, a small Python and Tkinter project as I'm a beginner and I almost finished it if it weren't for this little issue I have with it that I detected after doing a few tests. The program should say whether a ...
Trying to add numbers from a file subtrack them and put them into another file Question: file = open("byteS-F_FS_U.toff","r") f = file.readline() s = file.readline() file.close() f = int(f) s = int(s) u = s - f file = open("bytesS-F_FS_U","w") file.write(float(u) + '\n') file.cl...
rebinning a list of numbers in python Question: I've a question about rebinning a list of numbers, with a desired bin-width. It's basically what a frequency histogram does, but I don't want the plot, just the bin number and the number of occurrences for each bin. So far I've already written some code that does what I ...
NumPy/Pandas: convert array of "steps" into bool mask Question: I have an array like this: arr = np.array([4, 6, 3, 9, 2, 100, 3, 1, 1, 1, 1]) I want to convert it to a bool array like this: [ T, F, F, F, T, F, T, F, F, T, T] # 4, 6, 3, 9, 2, 100, 3, 1, 1, 1, 1 I can do i...
Undefined index: HTTP_ACCEPT_LANGUAGE using BeatifulSoup/Python Question: I'm learning Python and I'm trying to parse a webpage made with PHP using BeautifulSoup. My problem is my script show this error: <div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;"> <h4>A PHP Error was e...
Getting TypeError with speech_recognition module in Python Question: I want to convert speech to text in real time using the module `SpeechRecognition 3.4.6` I've installed everything and now I am trying a simple code from example, here's the code: import speech_recognition as sr # obtain audio ...
Remove duplicate rows from CSV Question: I have a CSV file that looks like this red,75,right red,344,right green,3,center yellow,3222,right blue,9,center black,123,left white,68,right green,47,left purple,48,left purple,988,right pink,2677,left white,34,right ...
Regex to strip only start of string Question: I am trying to match phone number using regex by stripping unwanted prefixes like 0, *, # and + e.g. +*#+0#01231340010 should produce, 1231340010 I am using python re module I tried following, re.sub(r'[0*#+]', '', ...
Scraping text from multiple web pages in Python Question: I've been tasked to scrape all the text off of any webpage a certain client of ours hosts. I've managed to write a script that will scrape the text off a single webpage, and you can manually replace the URL in the code each time you want to scrape a different we...
Problems using HTTPSConnection with http.client Question: I'm new to Python and especially to web coding. I'm trying to make a program that asks for a name and a surname, and then check on Pipl if there is any result(s). My "tactic" is to directly go to the URL (containing the information) with the result, without usin...
Accessings deeply nested dictionary/list elements/values in Python Question: I've been racking my brain on this problem and the logic needed to step through this output from Google Maps API. Essentially I'm using google maps Distance_Matrix: Here is an example of the returned information from a call of the API for dis...
How to create a UNIX timestamp for every minute in Python Question: I want to create a UNIX timestamp for the date `2014-10-31` for every minute of the day. I have got a timestamp for the date but not for every minute - import datetime date = '2014-10-31' t_stamp = int(time.mktime(datetime.dateti...
why is this formula for a circle giving me an ellipsoid in Javascript but a circle in Python? Question: I adapted the following code for python found on this [page](http://stackoverflow.com/a/15890673/2075859): for a Javascript equivalent. import math # inputs radius = 1000.0 # m - the follo...
Get location from response header Question: I am trying to get the `Location` value from a `POST` request using python's requests module. However, when I look at the response's headers, I don't see any such key. Performing the same request using Google Chrome does show the key. This is where I am trying to download da...
Python script for web scraping from web pages to find ip address for urls present in it Question: I have started writing script as mentioned below import urllib2 from bs4 import BeautifulSoup trg_url='http://timesofindia.indiatimes.com/' req=urllib2.Request(trg_url) handle=urllib2.ur...
I typed python -v in my terminal and something weird happened Question: Thinking I was about to check the version of Python installed on my computer, I typed python -v in my terminal and I got a first line saying > "installing zipimport hook", but then also a whole bunch of text (probably > 50 or...
How to retrieve a total pixel value above an average-based threshold in Python Question: Currently, I am practicing with retrieving the total of the pixel values above a threshold based on the mean of the whole image. (I am very new to Python). I am using Python 3.5.2, and the above code was copied from the Atom progra...
generate a heatmap from a dataframe with python and seaborn Question: I'm new to Python and fairly new to seaborn. I have a pandas dataframe named df which looks like: TIMESTAMP ACT_TIME_AERATEUR_1_F1 ACT_TIME_AERATEUR_1_F2 ACT_TIME_AERATEUR_1_F3 ACT_TIME_AERATEUR_1_F4 ACT_TIME_AERATEUR_1_F5 ACT_TIME_AE...
How can I count a word from all lines that are 2 rows after a specific line? Question: So, this might sound a bit confusing, I'll try to explain it. For example from these lines: next line 1 ^^^^^^^^^^^^^^^^^^ red blue dark ten lemon next line 2 ^^^^^^^^^^^^^^^^^^^ hat 45 no dad fate ...
Proper Use Of Python 3.x AMFY Module Question: How am I supposed to use the Amfy module? I try to use it like the JSON module (`amfy.loads` or `amfy.load`), but it just gives me errors: C:\Users\Other>"C:\Users\Other\Desktop\Python3.5.2\test amf.py" Traceback (most recent call last): File "C:\U...
python multiprocessing.Array: huge temporary memory overhead Question: If I use python's multiprocessing.Array to create a 1G shared array, I find that the python process uses around 30G of memory during the call to multiprocessing.Array and then decreases memory usage after that. I'd appreciate any help to figure out ...
parallel program in python using Threads Question: Generating the sum from adding integer numbers successively up to n where n = 2000 given by the following formula: n(n+1)/2 so far i have don it in serial.I need help on how to make it compute in parallel such that it adaptively make use of all the available processors...
Find parent with certain combination of child rows - SQLite with Python Question: There are several parts to this question. I am working with sqlite3 in Python 2.7, but I am less concerned with the exact syntax, and more with the methods I need to use. I think the best way to ask this question is to describe my current...
Improve performance of constraint-adding in Gurobi (Python-Interface) Question: i got this decision variable: x={} for j in range(10): for i in range(500000): x[i,j] = m.addVar(vtype=GRB.BINARY, name="x%d%d" %(i,j)) so i need to add constraints for each x[i,j] variable like ...
How to sum Threads in python Question: I need help on how i can sum all the threads.to get sum of thread one to three all together..The parallel program should use all processors in host computer import threading import time from datetime import datetime start_time = datetime.now() ...
Sign extending from a variable bit width Question: Here is a code in C++: #include <iostream> #include<limits.h> using namespace std; void sign_extending(int x,unsigned b) { int r; // resulting sign-extended number int const m = CHAR_BIT * sizeof(x) - b; r = (x...
Why is my blitted characted not moving in pygame? Question: I am making an RPG in Python using Pygame. My first step is to create my main character and let it move. But it isn't. This is my code: import pygame,random from pygame.locals import * pygame.init() black = (0,0,0) whit...
Rosalind Profile and Consensus: Writing long strings to one line in Python (Formatting) Question: I'm trying to tackle a problem on Rosalind where, given a FASTA file of at most 10 sequences at 1kb, I need to give the consensus sequence and profile (how many of each base do all the sequences have in common at each nucl...
Make console-friendly string a useable pandas dataframe python Question: A quick question as I'm currently changing from R to pandas for some projects: I get the following print output from `metrics.classification_report` from `sci-kit learn`: precision recall f1-score support...
Is there an equivalent for Glob in D Phobos? Question: In python I can use glob to search path patterns. This for instance: import glob for entry in glob.glob("/usr/*/python*"): print(entry) Would print this: /usr/share/python3 /usr/share/python3-plainbox /usr/sha...
Cannot build master of Tensorflow Serving Question: I've built Tensorflow from source, CUDA 8.0, python 3.5, Ubuntu 16.04, targeting a NVIDIA 1070, and it works fine. > Python 3.5.2 (default, Jul 5 2016, 12:43:10) [GCC 5.4.0 20160609] on linux > Type "help", "copyright", "credits" or "license" for more information. > ...
regarding the parameters in os.path.join Question: I am trying to reproduce a python program, which includes the following line of code data = glob(os.path.join("./data", config.dataset, "*.jpg")) My guess is that it will capture all `.jpg` files stored in `/data` folder. But I am not sure the usag...
How to call methods inside a class? Question: I have a test Python class named calc with two methods `add` and `sub`. How can I run the methods from the python prompt? I am at the python command line ">>>" and typing `import calc`. Then I type `calc.add(5,3)` and get "No module named 'calc'". File name is `calc.py`. ...
Locating a graphic function (Python) Question: First off, thanks to the site and everybody on it. I am taking my first python class and have come across this site many times when trouble-shooting coding problems. Thanks to everybody who have already helped me out a little thus far. But, I do have a problem I can't figu...
Custom User Model ValueError: Related Model Django(1.9) Question: There is an error when I try to add CustomUser model as ForiegnKey to a field in django. The authentication is working using the CustomUser model but for some reason I have getting this error: ValueError: Related model 'authentication.User...
Selenium - Login raises ElementNotVisibleException Question: I am using Selenium Webdriver to login to a site. I've tried multiple different selectors, and have tried implicit waits, but cannot locate the element. from selenium import webdriver from selenium.webdriver.common.by import By ...
Use requests module in Python to log in to Barclays premier league fantasy football? Question: I'm trying to write a Python script to let me log in to my fantasy football account at <https://fantasy.premierleague.com/>, but something is not quite right with my log in. When I login through my browser and check the detai...
How to specify log file name with spider's name in scrapy? Question: I'm using scrapy,in my scrapy project,I created several spider classes,as the official document said,I used this way to specify log file name: def logging_to_file(file_name): """ @rtype: logging @type file_name:str @par...
Python: Installing gooey using pip error Question: I am trying to install Gooey for python and I keep on getting this error in cmd ... I installed the latest version of pip and am running on the latest version of python: C:\Users\markj>pip install Gooey Collecting Gooey Using cached Gooey-0.9.2...
How to parse a 'JSON string' file in Python? Question: I am working on something that is quite similar to [this topic](http://stackoverflow.com/questions/13938183/python-json-string-to-list- of-dictionaries-getting-error-when-iterating).I downloaded a file which seems like to be a JSON file. But when I open it in notep...
Python re.search anomaly Question: I have a routine that searches through a directory of files and extracts a customer number from the filename: import os import re suffix= '.csv' # For each file in input folder, extract customer number input_list = os.listdir(path_in) for ...
How to remove part of the string after specific word in Python Question: I get API-responses as a string which can be in two different formats: 1) `This is a message. <br><br>This message was created by Jimmy.` 2) This is a message. Text can be in the new row. This message was created...
Using py2exe packing python program with ply got strange error? Question: I downloaded the [PLY](http://www.dabeaz.com/ply/), and ran a simple test in `ply3.8/test/calclex.py` # ----------------------------------------------------------------------------- # calclex.py # --------------------------...
Importing multiple revisions in sync into SVN Question: I have been developing a project without SVN for a while and now I wish to use SVN. I have been keeping many revisions of this project as a series of numbered tar.bz2 files (tarballs). I would like to import these many tarballs into an SVN repository and keep the ...
how can i call mutiple files(bash files) from subprocess.call in python Question: #i am trying to run all the bash scripts in plugin folder import sys,os,subprocess folder_path=os.listdir(os.path.join(os.path.dirname(__file__),'plugins')) sys.path.append(os.path.join(os.path.dirname(__fil...
how to get a folder name and file name in python Question: I have a python program named `myscript.py` which would give me the list of files and folders in the path provided. import os import sys def get_files_in_directory(path): for root, dirs, files in os.walk(path): pr...
Python ctypes.BigEndianStructure can't store a value Question: I am in trouble with ctypes.BigEndianStructure. I can't get the value that I set to one the fields. My code is like this. import ctypes class MyStructure(ctypes.BigEndianStructure): _pack_ = 1 _fields_ = [ ('fx...
Getting python to run an application when the application needs an input file Question: import subprocess subprocess.call(['C:\\Users\michael\\Desktop\\Test\\pdftotext']) pdftotext is the application that will run if I use this ^ code. This works fine, however, I'm trying to find a way to run pdftotext t...
can a return value of a function be passed in the where clause Question: I have a python code that displays a list of station ID and air temperature for certain number of days. In the code below I have passed the dates as a list. But that is cumbersome coding since I have to write all the dates in the list. Is there an...
truncated incorrect value Question: I have a python code that displays a range of dates. In the code below I have passed the dates in the select operation by casting the dates and using STR_TO_DATE function. I want to know how a range of values with start and end date can be passed in the query below. what i want to ac...
Convert string of list of dictionary to Python DataFrame Question: I have a .JSON file which is around 3GB. I would like to read this JSON data and load it to pandas data frames. Below is what i did so far.. Step 1: Read JSON file import pandas as pd with open('MyFile.json', 'r') as f: data ...
Python itertools with multiprocessing - huge list vs inefficient CPUs usage with iterator Question: I work on n elements (named "pair" below) variations with repetition used as my function's argument. Obviously everything works fine as long as the "r" list is not big enough to consume all the memory. The issue is I hav...
Get password in Python Programming Language Question: Is there any builtin function that can be used for getting a password in python. I need answer like this Input: Enter a username: abcdefg Enter a password : ******** If i enter a password abcdefgt. It shows like ********. Answer: ### Original There is a function...
Send data from django to html Question: I want to get data from database and send that to html page using django- python. What I'm doing in python file is def module1(request): table_list=student.objects.all() context={'table_list' : table_list} return render(request,'index.h...
Python pandas producing error when trying to access 'DATE' column on large data set Question: I have a file with 3'502'379 rows and 3 columns. The following script is supposed to be executed but raises and error in the date handling line: import matplotlib.pyplot as plt import numpy as np import ...
trying to scrape text from html that doesnt have any distinctive tags except br, PYTHON 3 Question: so I have been making a scraping program for my company websites but I have run into an issue, basically I need to scrape out test from a html table but The I am having trouble getting the data I need. HTML CODE ...
Convert float to string without scientific notation and false precision Question: I want to print some floating point numbers so that they're always written in decimal form (e.g. `12345000000000000000000.0` or `0.000000000000012345`, not in [scientific notation](https://en.wikipedia.org/wiki/Scientific_notation), yet I...
Importing pyplot in a Jupyter Notebook Question: Running Python 2.7 and trying to get plotting to work the tutorials recommend the below command. from matplotlib import pyplot as plt Works fine when run from the command line python -c "from matplotlib import pyplot as plt" but ...
How to jump on specific Page usinig Beautifulsoup Question: I want to get data for Product which are search by user in python.I am able to get data from any Urls but depending upon search Jump on that page and Get data Using beautifulsoup. I Try this for get data : from bs4 import BeautifulSoup impo...
Using sed to interpret multiple lines on condition Question: I'm stuck on constructing a **sed** expression that will parse a python file's imports and extract the names of the modules. This is a simple example that I solved using (I need the output to be the module names without 'as' or any spaces..): ...
HeatMap visualization Question: I have a dataframe df1 df1.info() <class 'pandas.core.frame.DataFrame'> RangeIndex: 38840 entries, 0 to 38839 Data columns (total 7 columns): TIMESTAMP 38840 non-null datetime64[ns] ACT_TIME_AERATEUR_1_F1 38696 non-null flo...
Monitoring the asyncio event loop Question: I am writing an application using python3 and am trying out asyncio for the first time. One issue I have encountered is that some of my coroutines block the event loop for longer than I like. I am trying to find something along the lines of top for the event loop that will sh...
Make a list of every column in a file in Python Question: I would like to create a list for every column in a txt file. The file looks like this: `NAME S1 S2 S3 S4 A 1 4 3 1 B 2 1 2 6 C 2 1 3 5` PROBLEM 1 . How do I dynamically make the number of lists that fit the number of columns, such that I can fill them? In som...
How to use subprocess to interact with a python script Question: I'm writing an IDE for python, in python, and need to use subprocess to intereact with a user's script. I am completely new to using subprocess and not sure what I'm doing here. I've created a test snippet representing what I'm trying to do: ...
Regular expressions in python to match Twitter handles Question: I'm trying to use regular expressions to capture all Twitter handles within a tweet body. The challenge is that I'm trying to get handles that 1. Contain a specific string 2. Are of unknown length 3. May be followed by either * punctuation ...
get Json data from request with Django Question: I'm trying to develop a very simple script in Django, I'd collect a Json data from the request and then store all data in the database. I developed one python script that I'm using to send the Json data to the Django view, but I'm doing something wrong and I can't under...
Using python regex to find repeated values after a header Question: If I have a string that looks something like: s = """ ... Random Stuff ... HEADER a 1 a 3 # random amount of rows a 17 RANDOM_NEW_HEADER a 200 a 300 ... More random stuff ... ""...
Choosing python data structures to speed up algorithm implementation Question: So I'm given a large collection (roughly 200k) of lists. Each contains a subset of the numbers 0 through 27. I want to return two of the lists where the product of their lengths is greater than the product of the lengths of any other pair of...
How to call a function that is later in a Python script? Question: I am currently learning Python for some penetration testing and was practicing making password cracking scripts. While I was making a script for a telnet pass cracker I ran into a problem with some of the functionality of it. While trying to allow the u...
Exiting interactive python3 session from script Question: I'd like my program to automatically exit if it detects an error when loading a file and parsing it (even when called from an interactive mode with -i). I've tried variations of `exit()` and `sys.exit()`, but nothing seems to be working. Instead of exiting the i...
Or statements for complex regex formation in python Question: I need to formulate a regex to pick up only the first part of a particular string rather than the second part. For example: (part1) (Part2) SAI Table ...