commited all contents created by participants
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
https://pypi.python.org/pypi/wikipedia
|
||||
Wikipedia is a Python library that makes it easy to access and parse data from Wikipedia.
|
||||
|
||||
Search Wikipedia, get article summaries, get data like links and images from a page, and more. Wikipedia wraps the MediaWiki API so you can focus on using Wikipedia data, not getting it.
|
||||
|
||||
https://wikipedia.readthedocs.io/en/latest/
|
||||
|
||||
https://wikipedia.readthedocs.io/en/latest/quickstart.html#quickstart
|
||||
Binary file not shown.
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8
|
||||
# this is a shebang: https://en.wikipedia.org/wiki/Shebang_%28Unix%29
|
||||
|
||||
'''
|
||||
This script takes a sentence you write in the terminal, and gives it back in alphabetical order
|
||||
A list is ordered and changeable. It is less efficient than a set/tuple. But it allows to work with index numbers.
|
||||
Check out other options for list comprehension: https://docs.python.org/3/tutorial/datastructures.html
|
||||
Made for OLA #5, Paris, 15-17 décembre 2017
|
||||
'''
|
||||
|
||||
# Ask to write a sentence
|
||||
sentence = "Les gouvernements suspectent la littérature parce qu’elle est une force qui leur échappe"
|
||||
sentence1 ="Le gouvernement impose au CNNum l’exclusion de Rokhaya Diallo."
|
||||
print(sentence1[-1])
|
||||
sentence1 = sentence1[: -1]
|
||||
# print sentence
|
||||
print("phrase originale:", sentence1)
|
||||
|
||||
# Split sentence into words
|
||||
words = sentence1.lower().split()
|
||||
print(words)
|
||||
|
||||
# sort words of list
|
||||
words.sort()
|
||||
|
||||
# print sorted wordlist as string
|
||||
print("phrase alphabétique:", " ".join(words).capitalize()+'.')
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#déclarer les variables
|
||||
letter1 = "S"
|
||||
letter2 = "N"
|
||||
letter3 = "C"
|
||||
letter4 = "F"
|
||||
print(letter1+letter2+letter3+letter4)
|
||||
# print(letter1, letter2, letter3, letter4)
|
||||
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python
|
||||
# encoding=utf8
|
||||
|
||||
# Copyright (C) 2016 Constant, Algolit
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details: <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# Reduction of letters
|
||||
# From string to list & back
|
||||
# A string: a list of characters, unchangeable, but treatable
|
||||
# See: https://www.tutorialspoint.com/python3/python_strings.htm
|
||||
|
||||
# Write sentence as string
|
||||
sentence = "Je vois La Vie en rose..."
|
||||
# Print sentence
|
||||
print("phrase originale:", sentence)
|
||||
|
||||
# define new word as list
|
||||
new_word = []
|
||||
|
||||
# Convert sentence in list of words
|
||||
words = sentence.split(" ")
|
||||
print(words)
|
||||
# For each word in word list
|
||||
for word in words:
|
||||
# remove capital letters (string operation)
|
||||
word = word.lower().strip(" ;''?:,()!.\").”-")
|
||||
# Clean punctuation (string operation)
|
||||
# word = word.strip(" ;''?:,()!.\").”-")
|
||||
# add word to new word list
|
||||
new_word.append(word)
|
||||
|
||||
# Write words as one, without punctuation
|
||||
print("phrase mise en mots:", ''.join(new_word))
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env python
|
||||
# coding: utf8
|
||||
|
||||
# More options with Wordnet: http://www.nltk.org/howto/wordnet.html
|
||||
|
||||
from nltk.corpus import wordnet as wn
|
||||
|
||||
print([synset.lemma_names('fra') for synset in wn.synsets('société', lang='fra')])
|
||||
|
||||
'''
|
||||
[['canis_familiaris', 'chien'], ['aboyeur', 'chien', 'chienchien', 'clébard', 'toutou'], ['chien', 'chien_de_chasse'], ['chien'], ['chien', 'clic', 'cliquer', 'cliquet'], ['chien', 'franc', 'hot-dog'], ['achille', 'chien', 'quignon', 'talon'], ['chien'], ['chien']
|
||||
'''
|
||||
@@ -0,0 +1,7 @@
|
||||
import wikipedia
|
||||
|
||||
wikipedia.set_lang("fr")
|
||||
|
||||
#wikipedia.search("Barack")
|
||||
paris = wikipedia.page("Paris")
|
||||
print(paris.content)
|
||||
Reference in New Issue
Block a user