python

13 posts

Python tutorial – w3schools based

This is my learning log from w3schools python tutorial Python HOME (todo) todo Python Intro https://www.w3schools.com/python/python_intro.asp Python Get Started https://www.w3schools.com/python/python_getstarted.asp Python Syntax https://www.w3schools.com/python/python_syntax.asp Python Comments https://www.w3schools.com/python/python_comments.asp Python Variables Python Variables https://www.w3schools.com/python/python_variables.asp Variable names https://www.w3schools.com/python/python_variables_names.asp Asigning multiple variables https://www.w3schools.com/python/python_variables_multiple.asp Output Variables https://www.w3schools.com/python/python_variables_output.asp Global variables https://www.w3schools.com/python/python_variables_global.asp Python Data Types https://www.w3schools.com/python/python_datatypes.asp Python Numbers […]

numpy and pandas install problems

numpy and pandas install problems Failed building wheel for numpyRunning setup.py clean for numpyComplete output from command “C:\Users.……..\PRO\stocks\venv\Scripts\python.exe” -u -c “import setuptools, tokenize;_ file_=’C:\Users.….\AppData\Local\Temp\pip-install-pxslxiaw\numpy\setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” clean –all:Running from numpy source directory. setup.py clean is not supported, use one of the following instead: Add –force to your […]

How to install python on SSH

Install Python on web server via SSH Get latest version of Python. Here you can see versions: https://www.python.org/ftp/python/ wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz Decompress files: tar xvzf Python-3.9.0.tgz Open decompressed directory: cd Python-3.9.0 Install: ./configure –prefix=$HOME/.local Make: make Make install – will install pip and setup tools: make install Go to bash profile […]

Python googletrans

How to user googletrans # pip install googletrans # http://zetcode.com/python/googletrans/ # If we do not specify the source and the destination languages, # googletrans tries to detect the language and translates it into English. import googletrans from googletrans import Translator print(googletrans.LANGUAGES) # without language source and destination choose #translator = […]

List of Fibonacci in Python and Fibonacci function

Fibonnaci in python by token: # fibbonaci: fib_list = [0, 1] for i in range(10): fib_list.append(fib_list[-2] + fib_list[-1]) print(fib_list) Or if You want Python function to generate Fibonacci def funFibonaci(numberElements_in): fib_list = [0, 1] if numberElements_in == 1: return fib_list[-2] if numberElements_in == 2: return fib_list[-1] for i in range(numberElements_in-2): […]

Python list of dates between two dates

s_date = datetime.strptime(“2020-01-01”, “%Y-%m-%d”)e_date = datetime.strptime(“2020-01-15”, “%Y-%m-%d”)delta = e_date – s_datefor i in range(delta.days + 1): day = s_date + timedelta(days=i) l.insert(i, day) #print(day)print(l) or you can define function from datetime import datetime, timedeltas_date = datetime.strptime(“2020-01-01”, “%Y-%m-%d”)e_date = datetime.strptime(“2020-01-15”, “%Y-%m-%d”)def out_date_range(argStartDate, argEndDate): delta = argEndDate – argStartDate l = [] […]

Request library in Python

–– coding: utf-8 –– “”” Created on Fri Dec 13 22:26:18 2019 https://2.python-requests.org//pl/latest/user/quickstart.html @author: token “”” libs import requests strUrlAddress = ‘https://amazon.com’ get all url html data as text requests.get(strUrlAddress).text test a = requests.get(strUrlAddress) return html data a.text return encoding a.encoding json with server data , text lenthetc., meta, length […]