https://forum.raspberryitaly.com/showthread.php?tid=3524
Traduzione Italiana di The MagPi n.77
🔰 @raspberry_python
Traduzione Italiana di The MagPi n.77
🔰 @raspberry_python
🔴 اینترنت اشیا
خانه هوشمند
https://www.open-electronics.org/using-a-telegram-bot-and-a-demo-board-to-experiment-with-home-automation/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+OpenElectronics+%28Open+Electronics%29
🔰 @raspberry_python
خانه هوشمند
https://www.open-electronics.org/using-a-telegram-bot-and-a-demo-board-to-experiment-with-home-automation/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+OpenElectronics+%28Open+Electronics%29
🔰 @raspberry_python
Open Electronics
Using a Telegram Bot and a Demo Board to experiment with home automation - Open Electronics
Let’s discover the potential of the instant messaging app, Telegram, by creating a remote control, based on a smartphone and a WiFi powered demoboard. We may say that, when we have our smartphone in our hands, we have a door opened to the world. This is…
گرفتن موقعیت مکانی با زبان پایتون
import requests
ip_request = requests.get('https://get.geojs.io/v1/ip.json')
my_ip = ip_request.json()['ip']
print(my_ip)
geo_request_url = 'https://get.geojs.io/v1/ip/geo/' + my_ip + '.json'
geo_request = requests.get(geo_request_url)
geo_data = geo_request.json()
print(geo_data)
🔰 @raspberry_python
import requests
ip_request = requests.get('https://get.geojs.io/v1/ip.json')
my_ip = ip_request.json()['ip']
print(my_ip)
geo_request_url = 'https://get.geojs.io/v1/ip/geo/' + my_ip + '.json'
geo_request = requests.get(geo_request_url)
geo_data = geo_request.json()
print(geo_data)
🔰 @raspberry_python
https://www.howtogeek.com/139433/how-to-turn-a-raspberry-pi-into-a-low-power-network-storage-device/
❇️ @raspberry_python
❇️ @raspberry_python
How-To Geek
How to Turn a Raspberry Pi into a Low-Power Network Storage Device
Mix together one Raspberry Pi and a sprinkle of cheap external hard drives and you have the recipe for an ultra-low-power and always-on network storage device.
https://becominghuman.ai/turn-your-raspberry-pi-into-homemade-google-home-9e29ad220075
❇️ @raspberry_python
❇️ @raspberry_python
Medium
Turn your Raspberry Pi into homemade Google Home
Google Home is a beautiful device with built-in Google Assistant — A state of the art digital personal assistant by Google. — which you can…
https://www.tecmint.com/learn-vi-and-vim-editor-tips-and-tricks-in-linux/
vim text guide for beginners
یکی از بهترین تکست ادیتورهای ممکن 😁😍
raspberry_python
vim text guide for beginners
یکی از بهترین تکست ادیتورهای ممکن 😁😍
raspberry_python
Learn Useful ‘Vi/Vim’ Tips and Tricks for Beginners – Part 1
Master Vim: Top Tips and Tricks for Beginners - Part 1
In this article and the next of this 2-article series, we will review 15 useful vi/vim editor tips and tricks for enhancing your vim skills in Linux.
#آموزش
📌How to Draw a Circle Using Matplotlib in Python
>>> import matplotlib.pyplot as plt
>>> def create_circle():
circle= plt.Circle((0,0), radius= 5)
return circle
>>> def show_shape(patch):
ax=plt.gca()
ax.add_patch(patch)
plt.axis('scaled')
plt.show()
>>> if name== 'main':
c= create_circle()
show_shape(c)
❇️ @raspberry_python
📌How to Draw a Circle Using Matplotlib in Python
>>> import matplotlib.pyplot as plt
>>> def create_circle():
circle= plt.Circle((0,0), radius= 5)
return circle
>>> def show_shape(patch):
ax=plt.gca()
ax.add_patch(patch)
plt.axis('scaled')
plt.show()
>>> if name== 'main':
c= create_circle()
show_shape(c)
❇️ @raspberry_python
🌺 How to Open Up a New Web Browser Using Python
import webbrowser
webbrowser.open('http://www.dropbox.com')
#آموزش
❇️ @raspberry_python
import webbrowser
webbrowser.open('http://www.dropbox.com')
#آموزش
❇️ @raspberry_python
Dropbox
Dropbox is a modern workspace designed to reduce busywork-so you can focus on the things that matter. Sign in and put your creative energy to work.
❇️ How to Plot a Graph with Matplotlib from Data from a CSV File using the CSV Module in Python
import matplotlib.pyplot as plt
import csv
x=[]
y=[]
with open('csvfile1.txt', 'r') as csvfile:
plots= csv.reader(csvfile, delimiter=',')
for row in plots:
x.append(int(row[0]))
y.append(int(row[1]))
plt.plot(x,y, marker='o')
plt.title('Data from the CSV File: People and Expenses')
plt.xlabel('Number of People')
plt.ylabel('Expenses')
plt.show()
دیتاهای مورد استفاده
1,40
2,60
3,70
4,80
5,120
❇️ @raspberry_python
import matplotlib.pyplot as plt
import csv
x=[]
y=[]
with open('csvfile1.txt', 'r') as csvfile:
plots= csv.reader(csvfile, delimiter=',')
for row in plots:
x.append(int(row[0]))
y.append(int(row[1]))
plt.plot(x,y, marker='o')
plt.title('Data from the CSV File: People and Expenses')
plt.xlabel('Number of People')
plt.ylabel('Expenses')
plt.show()
دیتاهای مورد استفاده
1,40
2,60
3,70
4,80
5,120
❇️ @raspberry_python
گروه زبان C و میکروکنترلرها
https://t.me/joinchat/Bi883FCv4MTG4SSQDYF62w
https://t.me/joinchat/Bi883FCv4MTG4SSQDYF62w
#آموزش
🔴 string formating
قسمت اول
# old string formating style
print("My name is %s %s" %(name, family))
output : My name is hasan abshenasan
print("My name is %(name)s %(family)s" %{'name' : name, 'family' : family})
output : My name is hasan abshenasan
# new string formating style introduced in python 3 but later back-ported to Python 2.7
print("My name is {name} {family}".format(name = name.title(), family = family))
output : My name is hasan abshenasan
# String Interpolation / f-Strings (Python 3.6+)
print(f"My name is {name.title()} {family}")
output : My name is Hasan abshenasan
num1 = 5
num2 = 4
print(f"Five plus four is {num1 + num2} not {2 * (num1 + num2)}.")
output : Five plus four is 9 not 18
# Template Strings (Standard Library)
from string import Template
temp = Template('Hey, $name!')
print(temp.substitute(name=name))
output : Hey, hasan
template_String = "My name is $name $family"
print(Template(template_String).substitute(name = name, family = family))
output : My name is hasan abshenasan
txt = "hello world"
print(txt[:6])
output :hello
print(txt[6:])
output :world
print(txt[1:6])
output : hello
print(txt[::-1])
output : dlrow olleh
print(txt.capitalize())
output : Hello world
print(txt.title())
output : Hello World
print(txt.count('l'))
output : 3
print(txt.count('l',6,10))
output : 1
print(txt.endswith('world'))
output : True
print(txt.endswith('world', 5, 11))
output : True
print(txt.startswith("hello"))
output : True
print(txt.startswith("hello", 0, 8))
output : True
txt = "this is\ttesting example"
print(txt.expandtabs(16))
output : this is testing example
print(txt.find('exam'))
output : 16
print(txt.find('exam', 0, 20))
output : 16
print(txt.index('exam'))
output : 16
#difrent betwen index and find is if index cant find give error but find not
txt = "tabriz2018"
print(txt.isalnum())
#return true if text is alphabetic or numeric or both
output : True
txt = "tabriz"
print(txt.isalpha())
#return true if text only be alphabetic
output : True
num = "455635"
print(num.isdigit())
# return true if text consists of digits only
output : True
txt = "tabriz"
print(txt.isspace())
output : True
print(txt.isupper())
output : False
txt = " "
print(txt.isspace())
output : True
txt = "Tabriz City"
print(txt.istitle())
output : True
txt = "Tabriz city"
print(txt.istitle())
output : False
print(len(txt))
output : 11
txt = "TABRIZ"
print(txt.lower())
output : tabzriz
txt = "tabriz"
print(txt.upper())
ouput : TABRIZ
txt = "****tabriz****"
print(txt.rstrip('*'))
output :****tabriz
print(txt.lstrip('*'))
output : tabriz****
print(txt.strip('*'))
output : tabriz
intab = 'aeiou'
outtab = '12345'
txt = "this is test example"
transtab = txt.maketrans(intab, outtab)
print(txt.translate(transtab))
output : th3s 3s t2st 2x1mpl2
txt = "this is test example"
print(max(txt))
output : z
txt = "fkdgn"
print(min(txt))
ouput : d
txt = "this is test example"
print(min(txt.replace(' ','')))
ouput : a
با تشکر از مهندس
@milad_ghasemi_1
❇️❇️ @raspberry_python
🔴 string formating
قسمت اول
# old string formating style
print("My name is %s %s" %(name, family))
output : My name is hasan abshenasan
print("My name is %(name)s %(family)s" %{'name' : name, 'family' : family})
output : My name is hasan abshenasan
# new string formating style introduced in python 3 but later back-ported to Python 2.7
print("My name is {name} {family}".format(name = name.title(), family = family))
output : My name is hasan abshenasan
# String Interpolation / f-Strings (Python 3.6+)
print(f"My name is {name.title()} {family}")
output : My name is Hasan abshenasan
num1 = 5
num2 = 4
print(f"Five plus four is {num1 + num2} not {2 * (num1 + num2)}.")
output : Five plus four is 9 not 18
# Template Strings (Standard Library)
from string import Template
temp = Template('Hey, $name!')
print(temp.substitute(name=name))
output : Hey, hasan
template_String = "My name is $name $family"
print(Template(template_String).substitute(name = name, family = family))
output : My name is hasan abshenasan
txt = "hello world"
print(txt[:6])
output :hello
print(txt[6:])
output :world
print(txt[1:6])
output : hello
print(txt[::-1])
output : dlrow olleh
print(txt.capitalize())
output : Hello world
print(txt.title())
output : Hello World
print(txt.count('l'))
output : 3
print(txt.count('l',6,10))
output : 1
print(txt.endswith('world'))
output : True
print(txt.endswith('world', 5, 11))
output : True
print(txt.startswith("hello"))
output : True
print(txt.startswith("hello", 0, 8))
output : True
txt = "this is\ttesting example"
print(txt.expandtabs(16))
output : this is testing example
print(txt.find('exam'))
output : 16
print(txt.find('exam', 0, 20))
output : 16
print(txt.index('exam'))
output : 16
#difrent betwen index and find is if index cant find give error but find not
txt = "tabriz2018"
print(txt.isalnum())
#return true if text is alphabetic or numeric or both
output : True
txt = "tabriz"
print(txt.isalpha())
#return true if text only be alphabetic
output : True
num = "455635"
print(num.isdigit())
# return true if text consists of digits only
output : True
txt = "tabriz"
print(txt.isspace())
output : True
print(txt.isupper())
output : False
txt = " "
print(txt.isspace())
output : True
txt = "Tabriz City"
print(txt.istitle())
output : True
txt = "Tabriz city"
print(txt.istitle())
output : False
print(len(txt))
output : 11
txt = "TABRIZ"
print(txt.lower())
output : tabzriz
txt = "tabriz"
print(txt.upper())
ouput : TABRIZ
txt = "****tabriz****"
print(txt.rstrip('*'))
output :****tabriz
print(txt.lstrip('*'))
output : tabriz****
print(txt.strip('*'))
output : tabriz
intab = 'aeiou'
outtab = '12345'
txt = "this is test example"
transtab = txt.maketrans(intab, outtab)
print(txt.translate(transtab))
output : th3s 3s t2st 2x1mpl2
txt = "this is test example"
print(max(txt))
output : z
txt = "fkdgn"
print(min(txt))
ouput : d
txt = "this is test example"
print(min(txt.replace(' ','')))
ouput : a
با تشکر از مهندس
@milad_ghasemi_1
❇️❇️ @raspberry_python
#آموزش
🔴 string formating
قسمت دوم
txt = "this is a testing example really is example....wow!!! this is really testing"
print(txt.replace('is', 'was'))
ouput : thwas was a testing example really was example....wow!!! thwas was really testing
print(txt.rfind('z'))
ouput : 64
print(txt.rfind('is', 10,63))
ouput : 59
print(txt.rindex('z'))
#id rindex cant find z give error but rfind give -1
print(txt.split())
ouput : ['this', 'is', 'a', 'testing', 'example', 'really', 'is', 'example....wow!!!', 'this', 'is', 'really', 'testing']
print(txt.split('i',2))
ouput : ['th', 's ', 's a testing example really is example....wow!!! this is really testing']
print(txt.split('i'))
['th', 's ', 's a test', 'ng example really ', 's example....wow!!! th', 's ', 's really test', 'ng']
txt = "this is \ntxting example....\nwow!!!"
print(txt.splitlines())
output : ['this is ', 'txting example....', 'wow!!!']
txt = "This Is txting Example....WOW!!!"
print(txt.swapcase())
output : tHIS iS TXTING eXAMPLE....wow!!!
txt = "tabriz"
print(txt.zfill(20))
output : '00000000000000tabriz'
print(r"how use \n without go to new line", end="\n\n")
output : how use \n without go to new line
#with end you can add somthing at end of string for example i add two new line
for i in range(4):
print(i, end=", ")
output : 0, 1, 2, 3
با تشکر از مهندس
@milad_ghasemi_1
❇️❇️ @raspberry_python
🔴 string formating
قسمت دوم
txt = "this is a testing example really is example....wow!!! this is really testing"
print(txt.replace('is', 'was'))
ouput : thwas was a testing example really was example....wow!!! thwas was really testing
print(txt.rfind('z'))
ouput : 64
print(txt.rfind('is', 10,63))
ouput : 59
print(txt.rindex('z'))
#id rindex cant find z give error but rfind give -1
print(txt.split())
ouput : ['this', 'is', 'a', 'testing', 'example', 'really', 'is', 'example....wow!!!', 'this', 'is', 'really', 'testing']
print(txt.split('i',2))
ouput : ['th', 's ', 's a testing example really is example....wow!!! this is really testing']
print(txt.split('i'))
['th', 's ', 's a test', 'ng example really ', 's example....wow!!! th', 's ', 's really test', 'ng']
txt = "this is \ntxting example....\nwow!!!"
print(txt.splitlines())
output : ['this is ', 'txting example....', 'wow!!!']
txt = "This Is txting Example....WOW!!!"
print(txt.swapcase())
output : tHIS iS TXTING eXAMPLE....wow!!!
txt = "tabriz"
print(txt.zfill(20))
output : '00000000000000tabriz'
print(r"how use \n without go to new line", end="\n\n")
output : how use \n without go to new line
#with end you can add somthing at end of string for example i add two new line
for i in range(4):
print(i, end=", ")
output : 0, 1, 2, 3
با تشکر از مهندس
@milad_ghasemi_1
❇️❇️ @raspberry_python