- In the extension bar, click the AdBlock Plus icon
- Click the large blue toggle for this website
- Click refresh
- In the extension bar, click the AdBlock icon
- Under "Pause on this site" click "Always"
- In the extension bar, click on the Adguard icon
- Click on the large green toggle for this website
- In the extension bar, click on the Ad Remover icon
- Click "Disable on This Website"
- In the extension bar, click on the orange lion icon
- Click the toggle on the top right, shifting from "Up" to "Down"
- In the extension bar, click on the Ghostery icon
- Click the "Anti-Tracking" shield so it says "Off"
- Click the "Ad-Blocking" stop sign so it says "Off"
- Refresh the page
- In the extension bar, click on the uBlock Origin icon
- Click on the big, blue power button
- Refresh the page
- In the extension bar, click on the uBlock icon
- Click on the big, blue power button
- Refresh the page
- In the extension bar, click on the UltraBlock icon
- Check the "Disable UltraBlock" checkbox
- Please disable your Ad Blocker
- Disable any DNS blocking tools such as AdGuardDNS or NextDNS
- Disable any privacy or tracking protection extensions such as Firefox Enhanced Tracking Protection or DuckDuckGo Privacy.
If the prompt is still appearing, please disable any tools or services you are using that block internet ads (e.g. DNS Servers, tracking protection or privacy extensions).
Question
tarifa
dear Fellow Coder on Neowin
im using bash to pipe the gathered data through an Rscript like so:
cat random.csv | Rscript test.R arg >| delete.csv
My aim is to use the R package readr to both read stdin and write stdout. what is aimed: I found the answer to stdin here.
test.R #!/usr/bin/Rscript suppressMessages(library(readr)) args <- commandArgs(trailingOnly = TRUE) df.in <- read_csv(file("stdin")) write_csv(df.in, path = stdout())
My investigations gave back the foolowing:
There is a format_csv function for that in readr. Use this instead of write_csv:
cat(format_csv(df.in))
we also can use write.table:
write.table(x, file = "foo.csv", sep = ",", col.names = NA, qmethod = "double")
i found the following interesting help page: https://stat.ethz.ch/R-manual/R-devel/library/utils/html/write.table.html
import requests from bs4 import BeautifulSoup import pandas as pd def Main(urls): with requests.Session() as req: allin = [] for url in urls: r = req.get(url) soup = BeautifulSoup(r.content, 'html.parser') target = soup.find( "dl", class_="c-description-list c-description-list--striped") names = [item.text for item in target.findAll("dt")] names.append("url") data = [item.get_text(strip=True) for item in target.findAll("dd")] data.append(url) allin.append(data) df = pd.DataFrame(allin, columns=names) df.to_csv("data.csv", index=False, encoding="utf-8") urls = ['https://www2.daad.de/deutschland/studienangebote/international-programmes/en/detail/4722/', 'https://www2.daad.de/deutschland/studienangebote/international-programmes/en/detail/6318/'] Main(urls)
the question is. i want to write the results of the parser script to stdout . - i do not want to write it into the data-file.
Link to comment
https://www.neowin.net/forum/topic/1393718-write-stdout-using-write_csv%C2%A0/Share on other sites
1 answer to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now