How do I make a python flask route that displays a certain row of a .csv file depending on button pressedmultilevel vertical unorder list menuHow to import CSV file data into a PostgreSQL table?CSS - Excess space on the rightGridView Lines Not Showing up in IERemove space between 2 tables HTML CSS and image removes background imageChanging Menu Bar Font SizeCannot display HTML stringCSS position:fixed is working for the header but not for the footerTextarea too large for page?Invalid css style during zooming in calendar
Convert BAM to properly paired FASTQ files
Salt, pepper, herbs and spices
When I press the space bar it deletes the letters after it
How to know if blackberries are safe to eat
How to tell someone I'd like to become friends without letting them think I'm romantically interested in them?
Print the last, middle and first character of your code
Is anyone advocating the promotion of homosexuality in UK schools?
Why did Harry Potter get a bedroom?
Short story about Nobel Prize winning scientists that drop out when they realise they were incorrect
Civic overheating and hoses popping
How to say "How long have you had this dream?"
Historical experience as a guide to warship design?
Killing Magic Numbers: "const int" vs "constexpr int" (or is there no difference in the end)
Why weren't bootable game disks ever common on the IBM PC?
String manipulation with std::adjacent_find
Some interesting calculation puzzle that I made
How do you move up one folder in Finder?
Extract string from each line of a file
How to deal with moral/legal subjects in writing?
Are there any sports for which the world's best player is female?
If your plane is out-of-control, why does military training instruct releasing the joystick to neutralize controls?
Great Unsolved Problems in O.R
What were the main German words for a prostitute before 1800?
Can the Mage Hand cantrip be used to trip an enemy who is running away?
How do I make a python flask route that displays a certain row of a .csv file depending on button pressed
multilevel vertical unorder list menuHow to import CSV file data into a PostgreSQL table?CSS - Excess space on the rightGridView Lines Not Showing up in IERemove space between 2 tables HTML CSS and image removes background imageChanging Menu Bar Font SizeCannot display HTML stringCSS position:fixed is working for the header but not for the footerTextarea too large for page?Invalid css style during zooming in calendar
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am trying to make a Python Flask route and html page that will display a certain row on my CSV file depending on the button pressed. Go to this link for a better understanding.
Let me sum it up. I am displaying 2 columns out of 3 on the link above and when you click one of the underlined words it is displaying the third column. I want to only display the third column for whatever row is pressed on the previous page. How do i do this?
Here is the html page for the main display:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"/>
<script src="script.js"></script>
<style>
a
text-decoration: none;
body
background-color: darkblue;
color: white;
font-family: Arial, Helvetica, sans-serif;
margin: 0;
a.nounderline
text-decoration: none;
h2
font-size: 40px;
margin: 5;
p
font-size: 20px;
color: darkgrey;
margin-top: 20px;
table
border-collapse: collapse;
width: 100%;
tr.border_bottom td
border-bottom:1pt solid black;
th, td
padding: 10px;
text-align: left;
border-bottom: 3px solid #ddd;
border-top: 3px solid #ddd;
.container
display: flex;
justify-content: space-between;
padding: 5px;
width: 1250px;
.nav-link
display: flex;
align-items: center;
margin-top: 65px;
.nav-link ul
background-color: #000;
margin: 0;
padding: 0 0 3px;
list-style: none;
display: flex;
.nav-link li a
color: #eee;
font-size: 16px;
text-decoration: none;
padding: 0 10px;
white-space: nowrap;
.nav-link li + li a
border-left: 1px dotted #666;
</style>
</head>
<body>
<div class="container">
<div>
<h2 size="8" style="font-family:sans-serif"><b>Python Code</b>
</h2>
<p>Make use of this database of Python code to improve your current projects</p>
</div>
<div class="nav-link">
<ul>
<li><a href="/forums">Home</a></li>
<li><a href="/pythonforum">Forums</a></li>
<li><a href="/countdown">Countdown</a></li>
<li><a href="/addpythoncode">Add Python Code</a></li>
</ul>
</div>
</div>
<br/>
<table width="90%">
% for x in pythonforumdata: %
<tr>
<td width=20%><a href='/pythoncode' > x[0] </a></td>
<td width=20%> x[1] </td>
</tr>
% endfor %
</table><br/>
</body>
</html>
Here is the code on the other page that I want to only display 1 row:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body
background-color: darkblue;
color: white;
font-family: Arial, Helvetica, sans-serif;
margin: 0;
a.nounderline
text-decoration: none;
h1
font-size: 40px;
margin: 5;
tr.border_bottom td
border-bottom:1pt solid black;
th, td
border-top: 3px solid #ddd;
</style>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"/>
<script src="script.js"></script>
</head>
<body>
<table width="90%">
% for x in pythoncode: %
<tr>
<h1 align='center' size="6"> x[1] 'Code </h1>
<td width=20%> x[2] </td>
</tr>
% endfor %
</table><br/>
</body>
</html>
Here are the routes:
@app.route('/pythonforum')
def pythonforum():
myfile=open("/home/Ethankbdca/mysite/pythonforum.csv", "r")
# codename,name,code
reader = csv.reader(myfile)
headers = next(reader, None)
pythonforumdata = []
for x in reader:
# 0-codename; 1-name; 2-code
tup = (x[0],x[1],x[2])
pythonforumdata.append(tup)
return render_template('pythonforum.html', pythonforumdata=pythonforumdata)
@app.route('/pythoncode')
def pythoncode():
myfile=open("/home/Ethankbdca/mysite/pythonforum.csv", "r")
# codename,name,code
reader = csv.reader(myfile)
headers = next(reader, None)
pythoncode = []
for x in reader:
# 0-codename; 1-name; 2-code
tup = (x[0],x[1],x[2])
pythoncode.append(tup)
return render_template('pythoncode.html', pythoncode=pythoncode)
So if anyone can help me figure out what I can clean up and fix to make this work I would greatly appreciate that.
html css csv
add a comment |
I am trying to make a Python Flask route and html page that will display a certain row on my CSV file depending on the button pressed. Go to this link for a better understanding.
Let me sum it up. I am displaying 2 columns out of 3 on the link above and when you click one of the underlined words it is displaying the third column. I want to only display the third column for whatever row is pressed on the previous page. How do i do this?
Here is the html page for the main display:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"/>
<script src="script.js"></script>
<style>
a
text-decoration: none;
body
background-color: darkblue;
color: white;
font-family: Arial, Helvetica, sans-serif;
margin: 0;
a.nounderline
text-decoration: none;
h2
font-size: 40px;
margin: 5;
p
font-size: 20px;
color: darkgrey;
margin-top: 20px;
table
border-collapse: collapse;
width: 100%;
tr.border_bottom td
border-bottom:1pt solid black;
th, td
padding: 10px;
text-align: left;
border-bottom: 3px solid #ddd;
border-top: 3px solid #ddd;
.container
display: flex;
justify-content: space-between;
padding: 5px;
width: 1250px;
.nav-link
display: flex;
align-items: center;
margin-top: 65px;
.nav-link ul
background-color: #000;
margin: 0;
padding: 0 0 3px;
list-style: none;
display: flex;
.nav-link li a
color: #eee;
font-size: 16px;
text-decoration: none;
padding: 0 10px;
white-space: nowrap;
.nav-link li + li a
border-left: 1px dotted #666;
</style>
</head>
<body>
<div class="container">
<div>
<h2 size="8" style="font-family:sans-serif"><b>Python Code</b>
</h2>
<p>Make use of this database of Python code to improve your current projects</p>
</div>
<div class="nav-link">
<ul>
<li><a href="/forums">Home</a></li>
<li><a href="/pythonforum">Forums</a></li>
<li><a href="/countdown">Countdown</a></li>
<li><a href="/addpythoncode">Add Python Code</a></li>
</ul>
</div>
</div>
<br/>
<table width="90%">
% for x in pythonforumdata: %
<tr>
<td width=20%><a href='/pythoncode' > x[0] </a></td>
<td width=20%> x[1] </td>
</tr>
% endfor %
</table><br/>
</body>
</html>
Here is the code on the other page that I want to only display 1 row:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body
background-color: darkblue;
color: white;
font-family: Arial, Helvetica, sans-serif;
margin: 0;
a.nounderline
text-decoration: none;
h1
font-size: 40px;
margin: 5;
tr.border_bottom td
border-bottom:1pt solid black;
th, td
border-top: 3px solid #ddd;
</style>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"/>
<script src="script.js"></script>
</head>
<body>
<table width="90%">
% for x in pythoncode: %
<tr>
<h1 align='center' size="6"> x[1] 'Code </h1>
<td width=20%> x[2] </td>
</tr>
% endfor %
</table><br/>
</body>
</html>
Here are the routes:
@app.route('/pythonforum')
def pythonforum():
myfile=open("/home/Ethankbdca/mysite/pythonforum.csv", "r")
# codename,name,code
reader = csv.reader(myfile)
headers = next(reader, None)
pythonforumdata = []
for x in reader:
# 0-codename; 1-name; 2-code
tup = (x[0],x[1],x[2])
pythonforumdata.append(tup)
return render_template('pythonforum.html', pythonforumdata=pythonforumdata)
@app.route('/pythoncode')
def pythoncode():
myfile=open("/home/Ethankbdca/mysite/pythonforum.csv", "r")
# codename,name,code
reader = csv.reader(myfile)
headers = next(reader, None)
pythoncode = []
for x in reader:
# 0-codename; 1-name; 2-code
tup = (x[0],x[1],x[2])
pythoncode.append(tup)
return render_template('pythoncode.html', pythoncode=pythoncode)
So if anyone can help me figure out what I can clean up and fix to make this work I would greatly appreciate that.
html css csv
2
Welcome to SO! Where is the link? What is the code that you have tried so far? Please visit how to ask.
– Yulio Aleman Jimenez
Mar 26 at 1:34
I added it. the page is getting random lines added as i am fiddling with it.
– Ethan KoehlerBryant
Mar 26 at 2:00
add a comment |
I am trying to make a Python Flask route and html page that will display a certain row on my CSV file depending on the button pressed. Go to this link for a better understanding.
Let me sum it up. I am displaying 2 columns out of 3 on the link above and when you click one of the underlined words it is displaying the third column. I want to only display the third column for whatever row is pressed on the previous page. How do i do this?
Here is the html page for the main display:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"/>
<script src="script.js"></script>
<style>
a
text-decoration: none;
body
background-color: darkblue;
color: white;
font-family: Arial, Helvetica, sans-serif;
margin: 0;
a.nounderline
text-decoration: none;
h2
font-size: 40px;
margin: 5;
p
font-size: 20px;
color: darkgrey;
margin-top: 20px;
table
border-collapse: collapse;
width: 100%;
tr.border_bottom td
border-bottom:1pt solid black;
th, td
padding: 10px;
text-align: left;
border-bottom: 3px solid #ddd;
border-top: 3px solid #ddd;
.container
display: flex;
justify-content: space-between;
padding: 5px;
width: 1250px;
.nav-link
display: flex;
align-items: center;
margin-top: 65px;
.nav-link ul
background-color: #000;
margin: 0;
padding: 0 0 3px;
list-style: none;
display: flex;
.nav-link li a
color: #eee;
font-size: 16px;
text-decoration: none;
padding: 0 10px;
white-space: nowrap;
.nav-link li + li a
border-left: 1px dotted #666;
</style>
</head>
<body>
<div class="container">
<div>
<h2 size="8" style="font-family:sans-serif"><b>Python Code</b>
</h2>
<p>Make use of this database of Python code to improve your current projects</p>
</div>
<div class="nav-link">
<ul>
<li><a href="/forums">Home</a></li>
<li><a href="/pythonforum">Forums</a></li>
<li><a href="/countdown">Countdown</a></li>
<li><a href="/addpythoncode">Add Python Code</a></li>
</ul>
</div>
</div>
<br/>
<table width="90%">
% for x in pythonforumdata: %
<tr>
<td width=20%><a href='/pythoncode' > x[0] </a></td>
<td width=20%> x[1] </td>
</tr>
% endfor %
</table><br/>
</body>
</html>
Here is the code on the other page that I want to only display 1 row:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body
background-color: darkblue;
color: white;
font-family: Arial, Helvetica, sans-serif;
margin: 0;
a.nounderline
text-decoration: none;
h1
font-size: 40px;
margin: 5;
tr.border_bottom td
border-bottom:1pt solid black;
th, td
border-top: 3px solid #ddd;
</style>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"/>
<script src="script.js"></script>
</head>
<body>
<table width="90%">
% for x in pythoncode: %
<tr>
<h1 align='center' size="6"> x[1] 'Code </h1>
<td width=20%> x[2] </td>
</tr>
% endfor %
</table><br/>
</body>
</html>
Here are the routes:
@app.route('/pythonforum')
def pythonforum():
myfile=open("/home/Ethankbdca/mysite/pythonforum.csv", "r")
# codename,name,code
reader = csv.reader(myfile)
headers = next(reader, None)
pythonforumdata = []
for x in reader:
# 0-codename; 1-name; 2-code
tup = (x[0],x[1],x[2])
pythonforumdata.append(tup)
return render_template('pythonforum.html', pythonforumdata=pythonforumdata)
@app.route('/pythoncode')
def pythoncode():
myfile=open("/home/Ethankbdca/mysite/pythonforum.csv", "r")
# codename,name,code
reader = csv.reader(myfile)
headers = next(reader, None)
pythoncode = []
for x in reader:
# 0-codename; 1-name; 2-code
tup = (x[0],x[1],x[2])
pythoncode.append(tup)
return render_template('pythoncode.html', pythoncode=pythoncode)
So if anyone can help me figure out what I can clean up and fix to make this work I would greatly appreciate that.
html css csv
I am trying to make a Python Flask route and html page that will display a certain row on my CSV file depending on the button pressed. Go to this link for a better understanding.
Let me sum it up. I am displaying 2 columns out of 3 on the link above and when you click one of the underlined words it is displaying the third column. I want to only display the third column for whatever row is pressed on the previous page. How do i do this?
Here is the html page for the main display:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"/>
<script src="script.js"></script>
<style>
a
text-decoration: none;
body
background-color: darkblue;
color: white;
font-family: Arial, Helvetica, sans-serif;
margin: 0;
a.nounderline
text-decoration: none;
h2
font-size: 40px;
margin: 5;
p
font-size: 20px;
color: darkgrey;
margin-top: 20px;
table
border-collapse: collapse;
width: 100%;
tr.border_bottom td
border-bottom:1pt solid black;
th, td
padding: 10px;
text-align: left;
border-bottom: 3px solid #ddd;
border-top: 3px solid #ddd;
.container
display: flex;
justify-content: space-between;
padding: 5px;
width: 1250px;
.nav-link
display: flex;
align-items: center;
margin-top: 65px;
.nav-link ul
background-color: #000;
margin: 0;
padding: 0 0 3px;
list-style: none;
display: flex;
.nav-link li a
color: #eee;
font-size: 16px;
text-decoration: none;
padding: 0 10px;
white-space: nowrap;
.nav-link li + li a
border-left: 1px dotted #666;
</style>
</head>
<body>
<div class="container">
<div>
<h2 size="8" style="font-family:sans-serif"><b>Python Code</b>
</h2>
<p>Make use of this database of Python code to improve your current projects</p>
</div>
<div class="nav-link">
<ul>
<li><a href="/forums">Home</a></li>
<li><a href="/pythonforum">Forums</a></li>
<li><a href="/countdown">Countdown</a></li>
<li><a href="/addpythoncode">Add Python Code</a></li>
</ul>
</div>
</div>
<br/>
<table width="90%">
% for x in pythonforumdata: %
<tr>
<td width=20%><a href='/pythoncode' > x[0] </a></td>
<td width=20%> x[1] </td>
</tr>
% endfor %
</table><br/>
</body>
</html>
Here is the code on the other page that I want to only display 1 row:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body
background-color: darkblue;
color: white;
font-family: Arial, Helvetica, sans-serif;
margin: 0;
a.nounderline
text-decoration: none;
h1
font-size: 40px;
margin: 5;
tr.border_bottom td
border-bottom:1pt solid black;
th, td
border-top: 3px solid #ddd;
</style>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"/>
<script src="script.js"></script>
</head>
<body>
<table width="90%">
% for x in pythoncode: %
<tr>
<h1 align='center' size="6"> x[1] 'Code </h1>
<td width=20%> x[2] </td>
</tr>
% endfor %
</table><br/>
</body>
</html>
Here are the routes:
@app.route('/pythonforum')
def pythonforum():
myfile=open("/home/Ethankbdca/mysite/pythonforum.csv", "r")
# codename,name,code
reader = csv.reader(myfile)
headers = next(reader, None)
pythonforumdata = []
for x in reader:
# 0-codename; 1-name; 2-code
tup = (x[0],x[1],x[2])
pythonforumdata.append(tup)
return render_template('pythonforum.html', pythonforumdata=pythonforumdata)
@app.route('/pythoncode')
def pythoncode():
myfile=open("/home/Ethankbdca/mysite/pythonforum.csv", "r")
# codename,name,code
reader = csv.reader(myfile)
headers = next(reader, None)
pythoncode = []
for x in reader:
# 0-codename; 1-name; 2-code
tup = (x[0],x[1],x[2])
pythoncode.append(tup)
return render_template('pythoncode.html', pythoncode=pythoncode)
So if anyone can help me figure out what I can clean up and fix to make this work I would greatly appreciate that.
html css csv
html css csv
edited Mar 26 at 13:04
Ethan KoehlerBryant
asked Mar 26 at 1:27
Ethan KoehlerBryantEthan KoehlerBryant
85 bronze badges
85 bronze badges
2
Welcome to SO! Where is the link? What is the code that you have tried so far? Please visit how to ask.
– Yulio Aleman Jimenez
Mar 26 at 1:34
I added it. the page is getting random lines added as i am fiddling with it.
– Ethan KoehlerBryant
Mar 26 at 2:00
add a comment |
2
Welcome to SO! Where is the link? What is the code that you have tried so far? Please visit how to ask.
– Yulio Aleman Jimenez
Mar 26 at 1:34
I added it. the page is getting random lines added as i am fiddling with it.
– Ethan KoehlerBryant
Mar 26 at 2:00
2
2
Welcome to SO! Where is the link? What is the code that you have tried so far? Please visit how to ask.
– Yulio Aleman Jimenez
Mar 26 at 1:34
Welcome to SO! Where is the link? What is the code that you have tried so far? Please visit how to ask.
– Yulio Aleman Jimenez
Mar 26 at 1:34
I added it. the page is getting random lines added as i am fiddling with it.
– Ethan KoehlerBryant
Mar 26 at 2:00
I added it. the page is getting random lines added as i am fiddling with it.
– Ethan KoehlerBryant
Mar 26 at 2:00
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348609%2fhow-do-i-make-a-python-flask-route-that-displays-a-certain-row-of-a-csv-file-de%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348609%2fhow-do-i-make-a-python-flask-route-that-displays-a-certain-row-of-a-csv-file-de%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Welcome to SO! Where is the link? What is the code that you have tried so far? Please visit how to ask.
– Yulio Aleman Jimenez
Mar 26 at 1:34
I added it. the page is getting random lines added as i am fiddling with it.
– Ethan KoehlerBryant
Mar 26 at 2:00