Friday, 13 May 2022

Python

 What is extensible Python?

Extensible


If needed, you can write some of your Python code in other languages like C++. This makes Python an extensible language, meaning that it can be extended to other languages


scalable


scalability means the system's capability to handle a growing amount of work, in other words, an increasing number of requests.


• Easy integration with other languages



import org.python.util.PythonInterpreter;


public class JythonHelloWorld {

  public static void main(String[] args) {

    try(PythonInterpreter pyInterp = new PythonInterpreter()) {

      pyInterp.exec("print('Hello Python World!')");

    }

  }

}


Internet scripting


Python is not used in a web browser. The language executed in browsers such as Chrome, Firefox and Internet Explorer is JavaScript. Projects such as pyjs can compile from Python to JavaScript. However, most Python developers write their web applications using a combination of Python and JavaScript.



Component integration. Python scripts can easily communicate with other parts of an application, using a variety of integration mechanisms. Such integrations allow Python to be used as a product customization and extension tool.



What is Python Identifier?

“An identifier is a name given to an entity”.


In very simple words, an identifier is a user-defined name to represent the basic building blocks of Python. It can be a variable, a function, a class, a module, or any other object.



Lowercase letters (a to z)

Uppercase letters (A to Z)

Digits (0 to 9)

Underscore (_)

Examples of a valid identifier:


num1

FLAG

get_user_name

userDetails

_1234


https://techvidvan.com/tutorials/python-identifiers/



task to Jahan

1.difference between pythong integers


 Prints characters starting from 3rd to 5th 

print (str[2:5])


str[0]

str[1]

str[2]



>>> tr = 'Hello World!'

>>> print(tr[0])

H

>>> print(tr[1])

e

>>> print(tr[2])

l

>>> print(tr[2:4])

ll

>>> print(tr[2:5])

llo


Zaloni

 It is a ETL tool. will update more about this etl tool in the same post

excel to csv in python

 import pandas as pd,xlrd,glob

excel_files = glob.glob(r"D:\python\python_*.xlsx")

for excel_file in excel_files:

 print("Converting '{}'".format(excel_file))

  try:

      df = pd.read_excel(excel_file)

      output = excel_file.split('.')[0]+'.csv'

      df.to_csv(output,index=False)

  except KeyError:

      print(" Failed to convert")


how to see modules in python?

go to terminal

just type python

>>>help("modules")

this command will show list of available modules in your current python..